I am having some trouble redirecting these links properly through htaccess.
Website use to be dynamic, and is now static.
This page does not exist anymore, but there are still links out there that reference the page through these url's, so I need them redirected.
http://www.example.com/?en=about
and
http://www.example.com/index.php/?en=about
They should be redirected to a new static html page recently created.
What is the best way to go about this through htacess? I've tried some rewrites, but not working. Any help would be appreciated - thanks
I suggested that the file name matches the value en
RewriteEngine on
RewriteCond %{QUERY_STRING} ^en=([^&]+)
RewriteRule ^(index.php/|)$ /%1.html? [R,L]
If only one page - about-us, then code below
RewriteEngine on
RewriteCond %{QUERY_STRING} ^en=about
RewriteRule ^(index.php/|)$ /about-us.html? [R,L]
You should be able to 301 for permanent redirect:
Redirect 301 /old.php /new.php
So in your case you would want something like:
Redirect 301 /index.php/?en=about /about.php
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.