The rewriterule that I am using on localhost works the way I want it to work, but when I upload it to the server, it just doesn’t anymore.
RewriteRule ^(.*)$ index.php?url=$1 [QSA]
Locally it gives the desired url, localhost/links/ … But as soon as it’s on the server, I get this: www.domain.com/index.php?url=links/
I don’t understand why that is… and is there a way to fix it?
2
Answers
I found the answer, thanks AI...
Simply put, I just needed to add:
The only downside is that on localhost it redirects me to http://localhost/, but it works on the server.
Check the following:
.htaccess
overrides are allowed in your server’s configuration.mod_rewrite module
in Apache usinga2enmod rewrite
.RewriteRule
to ensure consistency between server andlocalhost like below:
the browser cache
mod_rewrite-related
messages in the server’s error logs..htaccess
file’s location should match on server &localhost.
[QSA,L,NC]
in your RewriteRule if needed.Note: If none of these steps resolve the issue, consider seeking assistance from your hosting provider’s support or a server administrator to diagnose and fix the problem.
#Apache-Age