Re: how to get rid of /index.php/ in short URLs (dirty hack for now) [repost]
"Paul_C" <[email protected]> Sat, 7 Feb 2004 02:06:32 +0000 (UTC)
| Newsgroups | gmane.comp.cms.xaraya.knowledge-base |
|---|---|
| Organization | Xaraya News Server |
| Message-ID | <[email protected]> |
Chris Dudley <[email protected]> wrote in news:pan.2003.05.12.12.51.33.905998-gn8pmO+6nszQT0dZR+AlfA@public.gmane.org: > From: [email protected] (mikespub) > If you have an Apache webserver with mod_rewrite enabled, here's how > you can get rid of the /index.php/ part in short URLs : > > > 1) in your xaraya home directory, use a .htaccess file with the > following mod_rewrite directives : > > > # turn mod_rewrite on for this directory > RewriteEngine on > # don't rewrite anything that starts with index.php > RewriteRule ^index\.php - [L] > # don't rewrite anything that ends with .jpg, .gif, .png, .css, .js > (customize) > RewriteRule \.(jpg|gif|png|css|js)$ - [L] > # rewrite everything else > RewriteRule ^(.+) index.php/$1 [L] > > > You can achieve the same thing with RewriteCond - I'm not > sure if it makes any difference, really. Well, it is easier if you have other existing material on the site and don't want it rewritten. I use: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.+) index.php/$1 [L] This checks to see if the requested url is a file or directory that already exists; if it doesn't then the url is rewritten and sent to xaraya for handling. A side effect of this, however, is that any broken links coming in or any broken images will be handled by xaraya. (Comment #3 on bug 1155 takes a look at the issue http://bugs.xaraya.com/show_bug.cgi?id=1155#c3).