Frank Nwoko
Frank Nwoko

Reputation: 3934

mod_rewrite .htaccess file

For some weird reason this works on localhost but doesn't work on remote server

---to remove .php extension from ALL php files

RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^([^.]+)$ $1.php [NC,L]

Upvotes: 2

Views: 279

Answers (2)

Amir Raminfar
Amir Raminfar

Reputation: 34169

You need to make sure mod_rewrite is enabled. You do this by putting

LoadModule rewrite_module modules/mod_rewrite.so

And adding this to top of .htaccess

RewriteEngine On

in you httpd.conf file.

Upvotes: 3

Stephen
Stephen

Reputation: 18917

also ensure that if your code is accessed in a subdirectory on the remote server, you set the correct RewriteBase in your .htaccess

Upvotes: 0

Related Questions