Forum Moderators: phranque
Yesterday everything was OK, but as I am designing more than one webpage I have decided to set up virtual hosts using apache so that I could have the physical files of each web in diferent directories. So after setting everything up Okay I have found out some problems in those webpages relating to the rewriterule. Here is the code:
RewriteEngine On
Options +FollowSymlinks
RewriteBase /
RewriteRule ^concerts/(.*)$ ./index.php?section=concerts¶metros=$1 [L]
After that, the browser says: "The requested URL ... was not found on this server." and apache error logs says: "[Thu Oct 01 23:47:33 2009] [error] [client 127.0.0.1] File does not exist: C:/webs/MyMusicWeb/concerts
It seems that it is not making the rewriterule. Why?
I'm not sure what the . on the right side of the rule is for?
RewriteRule ^concerts/(.*)$ ./index.php?section=concerts¶metros=$1 [L]
I would try:
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^concerts/(.*)$ /index.php?section=concerts¶metros=$1 [L]
The rewrite base is really unnecessary if you are going to use a / on the right side of the rule and the truth is it will probably do nothing more than confuse the issue, so I would go ahead and remove it.
"[Thu Oct 01 23:47:33 2009] [error] [client 127.0.0.1] File does not exist: C:/webs/MyMusicWeb/concerts
If the rule did not work, and the logged information is correct, then the requested URL was apparently "example.com/concerts" with no trailing slash. Since this does not match your rule's pattern, the rule woould not have been invoked for this request.
Your rule looks "correct enough" and should work. Do be sure to completely flush (delete) your browser cache after changing any server-side code.
Jim
So I have wrote these lines into the httpd.conf file:
<Directory c:/myWebDirectory>
Options FollowSymLinks
AllowOverride All
</Directory>
Doing that, Apache allows "myWebDirectory" folder to have an .htaccess file.
Thanks a lot to everybody
Jim