Home Redirect entire sub-directory to root directory
Reply: 0

Redirect entire sub-directory to root directory

user912
1#
user912 Published in May 20, 2018, 11:59 am

So I am trying to clean up my search engine redirect errors. I had some old development sites that got indexed that I want to redirect to the main site.

Basically I want everything in the /dev/ folder to go to https://myfakewebsite.com/

I added this to .htaccess file in the /dev/ directory:

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^(.*)$ /$1 [R=301,L]

I tried this but it doesn't quite work, it does take out the /dev/ but it keeps the rest of the link there.

For example: https://myfakewebsite.com/dev/index.php?route=product/category&path=122

redirects to: https://myfakewebsite.com/index.php?route=product/category&path=122

I want it to redirect to: https://myfakewebsite.com/ (removing the /index.php?route=product/category&path=122 part).

Is there a way to do this with .htaccess?

You need to login account before you can post.

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

© 2016 Powered by mzan.com design MATCHINFO