Search code examples
phpapache.htaccessxampp

Removing php url won't work on my XAMPP localhost but will work on server


Using the following code to remove php from URLS, works on my online server, but will not work in XAMPP local host

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*[^/])/?$ $1.php [L]

I've tried changing AllowOverride to all in httpd.conf file and changing other settings in conf files but can not figure out what's preventing it

TIA


Solution

  • Make sure that you have turned on mod_rewrite in your xampp (it can be turned on in your online server by default).

    Here you can check how to do it: https://ubiq.co/tech-blog/how-to-enable-mod_rewrite-in-xampp-wamp/