Forum Moderators: phranque
RewriteEngine on
Options +FollowSymLinks
RewriteBase /
#Rules
RewriteRule ^dir/$ [sitename.com...]
When I place the .htaccess in my root directory, www.sitename.com/dir/ -> www.sitename.com/file.php?name=X&type=Y&place=Z. However, when I click the back button, it says the page cannot be found! I have been searching on google and this site this afternoon and can find nothing. Anyone have any ideas? Thanks!
There's another problem, and that is that you code is probably doing an external redirect, thus rendering your efforts to get spiders to list more-friendly URLs moot.
You need to use the internal rewrite mode of mod_rewrite: which looks like this:
RewriteRule ^dir/$ /file.php?name=X&type=Y&place=Z [L]
The difference is that only a local URL-path is used, rather than a canonical URL.
Also, check out the back-referencing feature of mod_rewrite. It will allow you to "copy parameters" from the requested URL into the new one. If you find yourself creating dozens of rules to create the hard-coded query-strings, this can be useful.
Jim