I'm facing a quite strange behaviour of my .htaccess. Whenever I try to access a link rewritten by mod_rewrite, my .htaccess is refering to the root and not the subdirectory I'm working in. My folder structure looks like that:htdocs/
blog6/
.htaccess
My .htaccess looks like that:
Options +FollowSymLinks -MultiViews
ErrorDocument 401 /core/error/401.php
ErrorDocument 403 /core/error/403.php
ErrorDocument 404 /core/error/404.php
ErrorDocument 500 /core/error/500.html
RewriteEngine on
RewriteBase /blog6/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]*)$ /index.php?page=$1 [L]
But whenever I try to access a file through a rewritten url, I get a 404 error and the log says:
C:/xampp/htdocs/index.php' not found or unable to stat
So it seems like my .htaccess wants to access the file in the htdocs instead of using the subdirectory. When I write /blog6
in my rewriteRule, everything works fine, but why RewriteBase isn't working properly? If it's important, I'm using <base>
in my html
/blog6/
directory? – anubhava/blog6/
. I openhttp://localhost/blog6/login
which should be the rewritten form ofhttp://localhost/blog6/index.php?page=login
. If I put ablog6/
in front of the rewriteRule, it looks like that:RewriteRule ^([^/]*)$ /blog6/index.php?page=$1 [L]
and works. And that is the point where it's confusing me, as the rewriteBase has no impact... – Kommodore