2

I have have turned mod_rewrite on in a windows machine and created .htaccess in the root directory of my website, now after i wrote FAIL in it it gave me an internal server error then i replaced the code with this

Options +FollowSymLinks RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^(.+)$ /$1.php [L,QSA] 

I am trying to remove .php and make friendly URLs, when i am tring to load index without using .php it is giving me a 404 Not found error i have restarted the wamp server several times and the same problem. Can somebody help me here.

Thanks in advance

4
  • 1
    Have a look at your error logs. It should show you what the actual filename is that cannot be found. I'm thinking you're probably rewriting a file /test.php to /test.php.php now. Commented May 19, 2012 at 12:38
  • This is what i found it's looking inside the www directly script 'C:/wamp/www/destinations.php' not found or unable to stat Commented May 19, 2012 at 12:40
  • For removing .php it would suffice to use Options +MultiViews. Commented May 19, 2012 at 12:51
  • Can you give me an example it is my first time to use .htaccess files Commented May 19, 2012 at 12:53

2 Answers 2

4

I have changed the .htaccess to this

Options +FollowSymLinks RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php 

and it worked just in case somebody faces the same problem

Sign up to request clarification or add additional context in comments.

Comments

0

Remove the line RewriteCond %{REQUEST_FILENAME}.php -f. It is unnecessary.

2 Comments

I did as you said but the problem is it's looking inside c:\wamp\www Not c:\wamp\www\my_site_folder
The RewriteBase tells the server to go looking for /$1.php on the root of the domain.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.