Home How to redirect .php to .html using .htaccess
Reply: 0

How to redirect .php to .html using .htaccess

user1403
1#
user1403 Published in June 20, 2018, 1:20 am

This question already has an answer here:

  • 301 Redirect *.php to *.html via .htaccess? 1 answer

I uploaded my code on testing server and link is below

http://dynamicwebsite.co.in/kk/ksmotors/tafe/aboutus.html

Now I want when someone hit below URL then user redirect to above URL

http://dynamicwebsite.co.in/kk/ksmotors/tafe/index.php?page=aboutus.php

I used following .htaccess code but its not working

RewriteEngine On

#RewriteRule ^index.php?page=(.*).php/?$ $1/$2.html$3 [R=301,L]
#RedirectMatch 301 /form/5/.* www.example.com/form/12/name.html

RedirectMatch 301 /index.php?page=aboutus.php http://dynamicwebsite.co.in/kk/ksmotors/tafe/aboutus.html

#Disable php and html files in storage folders
RedirectMatch 403 (admin\/accessory\/images|admin\/careers\/images|admin\/categories\/images|admin\/css|admin\/images|admin\/jqgrid|admin\/models\/images|admin\/submodels\/images|css|images|js|php-captcha|resume|spec_doc).+\.(php|php3?|phtml|html)$

#Disable Directory Listing
Options -Indexes

can you please explain what is going wrong. Please help. Thanks

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.318531 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO