Edgewall Software

Changes between Version 11 and Version 12 of TracPrettyUrls


Ignore:
Timestamp:
Dec 31, 2007, 1:06:16 PM (16 years ago)
Author:
techtonik <techtonik@…>
Comment:

+ another way to make pretty URL via .htaccess

Legend:

Unmodified
Added
Removed
Modified
  • TracPrettyUrls

    v11 v12  
    99http://<subdomain>.<yourhostname>/
    1010
    11 this is one way, using mod_rewrite (in Apache):
     11there are several ways to do this on Apache:
    1212
    13 load the module mod_rewrite, then, place this in your apache config:
     13=== Using mod_rewrite through httpd.conf ===
     14If you have access to your Apache config, load the module mod_rewrite, then, place this in the config:
    1415(if you have subdomain, inside a !VirtualHost)
    1516
     
    3536}}}
    3637
    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 ===
     39Make an .htaccess file or add the following lines into existing if it's already present in your site directory with trac.fcgi
     40{{{
     41RewriteEngine On
     42RewriteCond %{REQUEST_FILENAME} !-f
     43RewriteCond %{REQUEST_FILENAME} !-d
     44RewriteRule ^(.*)$ /trac.fcgi/$1 [L,QSA]
     45RewriteRule ^$ trac.fcgi [L]
     46}}}
     47
     48Two 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{{{
     50RewriteCond %{REQUEST_URI} !^/(stats/|phpmyadmin) [NC]
     51}}}
     52
     53=== Easy access URL as a last resort ===
     54The 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:
    3855
    3956{{{<META HTTP-EQUIV="Refresh" CONTENT="0; URL=/cgi-bin/trac.cgi">}}}