You are not logged in.
I'd like to remove the "index.cgi", "index.php", or "index.html" filenames from all my site's urls, as long as there isn't an actual file with that filename. I would also like to keep the query string intact. Thus:
http://example.com/section1/index.php?name=whatever
should become
http://example.com/section1/?name=whatever
Below what I have come up with so far, and I'm sure it must be grossly mistaken. It doesn't seem to have an effect. I'm finding it very difficult to grasp mod_rewrite+regexps, so please help with this little thing?
# .htaccess file
RewriteEngine On
RewriteCond %{REQUEST_URI} !-f
RewriteCond %{REQUEST_URI} !-d
RewriteCond %{REQUEST_URI} /index\.(php|cgi|html)
RewriteRule ^.*$ / [R=301,L]
Offline
What I mean is that if the user types in "example.com/index.php?foo=bar" in his address bar, he will be redirected to "example.com/?foo=bar".
Offline
i forget parts of mod rewrite but something like this...
RewriteEngine On
# Anything index.php?cat=funtime goes to /?cat=funtime
RewriteCond %{REQUEST_URI} index\.(php|html|cgi)\?.*$ NC
RewriteRule index\.(php|html|cgi)\?(.*)$ /$2 R[=301]
# Now our url is pretty
RewriteCond %{REQUEST_URI} ^\?
RewriteRule ^(.*)$ index.php$1 [L]
something like that
rawr
Offline