Edgewall Software

Changes between Version 12 and Version 13 of TracPrettyUrls


Ignore:
Timestamp:
Feb 18, 2015, 5:37:59 PM (9 years ago)
Author:
figaro
Comment:

Cosmetic changes

Legend:

Unmodified
Added
Removed
Modified
  • TracPrettyUrls

    v12 v13  
    1 = Prettier URLs for Trac =
     1= Prettier URLs for Trac
    22
    3 If you would like the url to be like:
     3There are several ways to obtain clean URLs in Apache:
    44
    5 http://<yourhostname>/
     5`http://<yourhostname>/`
    66
    7 or (maybe with a subdomain):
     7`http://<subdomain>.<yourhostname>/`
    88
    9 http://<subdomain>.<yourhostname>/
     9== Using mod_rewrite through httpd.conf
    1010
    11 there are several ways to do this on Apache:
    12 
    13 === Using mod_rewrite through httpd.conf ===
    14 If you have access to your Apache config, load the module mod_rewrite, then, place this in the config:
    15 (if you have subdomain, inside a !VirtualHost)
     11If you have access to your Apache config, load the module `mod_rewrite`, then place this in the config:
    1612
    1713{{{
     
    2824}}}
    2925
    30 Or using !ScriptAliasMatch you can redirect all request coming to / without rewriting the URL to the user:
     26If you have a subdomain, it should go inside !VirtualHost tags, see [http://httpd.apache.org/docs/ Apache documentation].
     27
     28Or using !ScriptAliasMatch you can redirect all request coming to `/` without rewriting the URL to the user:
    3129
    3230{{{
     
    3634}}}
    3735
    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
     36== Using mod_rewrite from .htaccess files
     37
     38Make an .htaccess file or add the following lines into existing if it's already present in your site directory with trac.fcgi:
    4039{{{
    4140RewriteEngine On
     
    4645}}}
    4746
    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.
     47The !RewriteCond strings tell Apache to not fire redirection to Trac script if there is an existing file or directory with the requested name. The last rule works always and redirects root site requests to the TracCGI script.
     48
     49If 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:
    4950{{{
    5051RewriteCond %{REQUEST_URI} !^/(stats/|phpmyadmin) [NC]
    5152}}}
    5253
    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:
     54== Easy access URL as a last resort
     55
     56The above configurations of Apache will not allow the 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:
    5557
    5658{{{<META HTTP-EQUIV="Refresh" CONTENT="0; URL=/cgi-bin/trac.cgi">}}}
    5759
    58 or put the following in /usr/share/trac/htdocs/index.php if your server supports php to enable a transparent redirect.
     60Or put the following in /usr/share/trac/htdocs/index.php if your server supports PHP to enable a transparent redirect:
    5961<?php
    6062header("Location: /cgi-bin/trac.cgi");
     
    6264
    6365----
    64 See also: TracInstall, TracMultipleProjects, [http://projects.edgewall.com/trac/wiki/TracFaq#how-can-i-create-a-nice-url-to-access-trac-cgi TracFaq: "How can I create a nice URL to access trac.cgi?"]
     66See also: TracInstall, TracMultipleProjects, [http://trac.edgewall.org/wiki/0.12/TracFaq#how-can-i-create-a-nice-url-to-access-trac-cgi TracFaq: "How can I create a nice URL to access trac.cgi?"]