0

I want to rewrite the url

I used the .htaccess code as

RewriteEngine on
RewriteRule ^index.html$ index.php [L]

URL is http://www.example.com/dashboard/index.php

And I want to rewrite the url index.php to index.html

can someone give me the idea to rewrite

3 Answers 3

1

Try this

RewriteEngine on
RewriteRule ^(.*)\.html$ $1.php [nc]
Sign up to request clarification or add additional context in comments.

2 Comments

Not working. I am working in ubuntu server. I enabled the mod_rewrite. Is there any problem with mod_rewrite enabling
if its not enabled then it wont work. firstly check using php_info() is it enabled or not?
0

Depend where you have your .htaccess file. If it is in your root follder than you will have

 RewriteEngine on
 RewriteRule ^dashboard/index.html$ /dashboard/index.php [L]

Comments

0

you can use below code

RewriteEngine On
RewriteRule ^(.*)\.html$ $1.php [L]

If you want it to be done as a redirect instead of just a rewrite modify the [L] to [L,R]

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.