Post by mminten » 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:

Code: Select all

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/dev/(.*)$
RewriteRule ^(.*) https://garrysun.com/ [R=301,NC]
and

Code: Select all

RewriteRule ^dev/(.*)$ https://garrysun.com [R=301,NC,L]
These were all in the website's .htaccess file in the main directory. I also tried adding:

Code: Select all

Options +FollowSymLinks
RewriteEngine On

RewriteCond %{HTTP_HOST} ^(?:www\.)?garrysun\.com$ [NC] 
RewriteRule ^ https://garrysun.com/? [R=301,L]
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?

Active Member

Posts

Joined
Tue Nov 20, 2012 9:33 am


Post by IP_CAM » Sat Mar 31, 2018 9:07 am

OpenCart Community - Forum OpenCart 1.5+ - Support General Support ::)

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by victorj » Sun Apr 01, 2018 3:08 am

you could try this one.
it should be located in your .htaccess id folder /dev/

Code: Select all

RewriteCond %{SERVER_PORT} 443
RewriteRule ^(.*)$ https://garrysun.com/$1 [R=301,L]

Koeltechnische deurrubbers eenvoudig online op maat bestellen.
Alle niet stekplichtige onderdelen zoals scharnieren, sloten, randverwarming en verlichting voor alle typen koelingen en vriezers.
https://koelcel-onderdelen.com


User avatar
Expert Member

Posts

Joined
Sat Jun 25, 2011 4:09 am
Location - Alkmaar Holland

Post by mminten » Sat Apr 14, 2018 6:48 am

I tired 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://garrysun.com/dev/index.php?rout ... y&path=122

redirects to: https://garrysun.com/dev/index.php?rout ... y&path=122

I want it to redirect to: https://garrysun.com/

Is there a way to do this with .htaccess?

Active Member

Posts

Joined
Tue Nov 20, 2012 9:33 am

Who is online

Users browsing this forum: No registered users and 52 guests