Forum Moderators: phranque
I am cleaning up the urls on my site using htaccess and have run into a problem.
Options +FollowSymlinks
RewriteEngine on
RewriteBase /
Rewriterule ^home/ index.php [NC] works fine, but...
Options +FollowSymlinks
RewriteEngine on
RewriteBase /
Rewriterule ^about/ about.php [NC] gives a 404 error. Basically I can't rewrite with the same spelling, and am stumpted as to what to do.
Any help gratefully received.
James
The problem isn't that simple, because you're not rewriting to the same "spelling" -- "about/" is not equal to "about.php" at all. It differs in the sixth character position, and it differs in length. So that's probably not the problem.
It is more likely that the problem has to do with the *roles* these URLs play on your site, and how other directives are set up to support those roles. For example, is "about.php" the index file in the directory "about/"? If so, there may be a DirectoryIndex directive defined that is interfering with the desired operation. Alternatively, it may have to do with where "about/" and "about.php" are located; Your code assumes they are located in the same folder as your code.
Without a lot more information on what you are trying to accomplish and what problem you intend to solve, I can't offer much more.
Jim
It's a fairly simple site, all the .php files and the .htaccess file are located in the root folder, and the only other folder within that is called 'images/'. Having experimented a bit more I've found that I can't seem rewrite to any url that has the same name as one of my php files.
For example there is a file called iyc.php. If I try to rewrite index.php to iyc/ like this...
Rewriterule ^iyc/ index.php I get a 404, like the about/.
Experimenting further, I found that this works...
Rewriterule ^inde/ index.php and this gives a 404.
Rewriterule ^index/ index.php Thanks for your help
Does this work?
Options +FollowSymlinks [b]-MultiViews[/b]
RewriteEngine on
RewriteBase /
Rewriterule ^about/ about.php [NC]
Jim