Redirect Subdirectory to Main website
Posted: Sat Mar 31, 2018 3:16 am
I am trying to redirect an entire subdirectory (/dev/) to our main domain (https://garrysun.com/).
Basically links like this:
Should all go to:
We are using OpenCart 2.3.0.2
I have tried:
and
These were all in the website's .htaccess file in the main directory. I also tried adding:
In a .htaccess file by itself in the /dev/ directory. None of these options are working.
What is the best .htaccess rule to make this work?
Basically links like this:
Should all go to:
We are using OpenCart 2.3.0.2
I have tried:
Code: Select all
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/dev/(.*)$
RewriteRule ^(.*) https://garrysun.com/ [R=301,NC]
Code: Select all
RewriteRule ^dev/(.*)$ https://garrysun.com [R=301,NC,L]
Code: Select all
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(?:www\.)?garrysun\.com$ [NC]
RewriteRule ^ https://garrysun.com/? [R=301,L]
What is the best .htaccess rule to make this work?