3

I just installed WampServer on Windows7 and uncommented mod_rewrite and set AllowOverride to All in the httpd.config file.

I created an .htacess file and placed it in the root folder with the following statement:

options +FollowSymLinks
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php

I then created test1.php file and placed it in the same folder as the .htacess file. However, I still must provide the extension on the browser to view the file. Am I doing something wrong?

Thank you,

Fawadafr
  • 31
  • 2
  • 4

2 Answers2

1

This .htaccess file worked for me:

Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]

You may also want to make sure that mod_rewrite.so is enabled in Apache's httpd.conf:

LoadModule rewrite_module modules/mod_rewrite.so
JW8
  • 1,202
  • 3
  • 13
  • 26
0

Did you check if mod_rewrite is run by apache?

  • Click on the WampServer icon, select Apache, Apache modules
  • Scroll down until you see 'Rewrite_Module'
  • If there is no check mark before Rewrite_Module click on it to enable it.

Now things should work (I am not sure if you have to restart the Apache service, just try)