hello friends,
i trying to change the extension .php into .html in my local server but it still shows the .php extension.

i have test.php and after the mod_rewrite it just show the test.php but if i type in url test.html then it also show the same content of test.php, that i want but i don't want to type test.html in the url, i want it automatically change if i call the file test.php

the .htaccess code is here

Options +FollowSymLinks
RewriteEngine On
RewriteBase   /tests
RewriteRule ^/?test\.html$ test.php [L]

pls help to solve this prob.

Recommended Answers

All 2 Replies

Change [L] to [L,R] might work. I'm not a .htaccess pro but I know that the R stands for "Redirect", so that's the first thing that comes into my mind when I read your issue.

If you need to change this for all php files in that directory use:

RewriteRule ^(.*)\.html$ $1.php [L]
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.