37 | | '''Also Note:''' Another simple way to do this is to put a redirect in {{{/usr/share/trac/htdocs/index.html}}}, such as: |
| 38 | === Using mod_rewrite from .htaccess files === |
| 39 | Make an .htaccess file or add the following lines into existing if it's already present in your site directory with trac.fcgi |
| 40 | {{{ |
| 41 | RewriteEngine On |
| 42 | RewriteCond %{REQUEST_FILENAME} !-f |
| 43 | RewriteCond %{REQUEST_FILENAME} !-d |
| 44 | RewriteRule ^(.*)$ /trac.fcgi/$1 [L,QSA] |
| 45 | RewriteRule ^$ trac.fcgi [L] |
| 46 | }}} |
| 47 | |
| 48 | Two RewriteCond strings tell Apache do not fire redirection to Trac script if there is existing file or directory with requested name. The last rule works always and redirects root site requests to TracCGI script. If you want to explicitly exclude some paths from being handled by Trac (such as /stats URLs or /phpmyadmin etc. usually provided by hostings) then insert the third RewriteCond right after the second one. |
| 49 | {{{ |
| 50 | RewriteCond %{REQUEST_URI} !^/(stats/|phpmyadmin) [NC] |
| 51 | }}} |
| 52 | |
| 53 | === Easy access URL as a last resort === |
| 54 | The above configurations of Apache will not allow user to see "cgi-bin" or "trac.cgi" string in Trac URLs. However, if you just want to automatically redirect users from your site root to trac page - put a redirect in {{{/usr/share/trac/htdocs/index.html}}}, such as: |