0

I am trying to create simple same-domain redirects for an EE7 site on Dreamhost using the htaccess file. For instance, I want to redirect https://www.example.com/template_group/page1 to https://www.example.com/template_group/page2. I have tried:

Redirect 301 /template_group/page1 /template_group/page2

This works in terms of going to the right page, but the resulting url is not as desired: https://www.example.com/template_group/page2?/page1

The standard code to remove "index.php" is present:

RewriteCond %{THE_REQUEST} ^GET.index.php [NC] RewriteCond %{REQUEST_URI} !/innersys/. [NC] RewriteRule (.?)index.php/(.*) /$1$2 [R=301,NE,L]

RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php?/$1 [L]

When I remove the above from the .htaccess file the redirect behaves as expected, as long as I change the redirect to:

Redirect 301 /index.php/template_group/page1 /index.php/template_group/page2

With the code to remove index.php present I have tried:

RewriteRule ^template_group/page1$ /template_group/page2? [L,R=301,NC]

and also:

RewriteRule ^template_group/page1$ /template_group/page2? [L,R=301,NC,qsd]

But each yield the same result (added query) as:

Redirect 301 /template_group/page1 /template_group/page2

I have been adding the above code BELOW the opening "RewriteEngine On" and ABOVE the code to remove index.php.

With the standard code to remove "index.php" present how do I write the redirect for https://www.example.com/template_group/page1 to https://www.example.com/template_group/page2 and have the resulting URL be as intended ( https://www.example.com/template_group/page2 )?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.