Domanda

The path to my page is like wamp/www/a/b/c. In the last "c" Folder there is a .htaccess:

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?p=$1 [L,QSA]

Until today, it worked, it redirected all calls to localhost/a/b/c/path1/path2 to localhost/a/b/c/index.php?p=path1/path2. But today no more - all calls like localhost/a/b/c/something are redirected to localhost start page. I don't know why. I made a quick workaround changing last line to

RewriteRule ^(.*)$ a/b/c/index.php?p=$1 [L,QSA]

Any idea how to fix this (not to use the path in .htaccess file).

I haven't changed any server configs last time.

È stato utile?

Soluzione

It is because your RewriteBase is incorrect. It should reflect the relative path from DocumentRoot. Use this:

RewriteEngine on
RewriteBase /a/b/c/

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ index.php?p=$1 [L,QSA]
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top