Home How do I force https and then match a RewriteRule that redirects from an old sub-directory to a new sub-directory?
Reply: 0

How do I force https and then match a RewriteRule that redirects from an old sub-directory to a new sub-directory?

user1928
1#
user1928 Published in June 18, 2018, 7:34 am

Here is the code that I've written and an explanation below:

RewriteEngine On
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://www.webringtheparty.com/$1 [R=301, NC]

RewriteBase /category/
RewriteRule ^our-rentals/concessions-tents-tables-chairs/generator-rental generators [R=301,L]
RewriteRule ^our-rentals/bounce-slide-combos-rentals/(.*) combo_bounce_house_rentals [R=301,L]
RewriteRule ^product-tag/moonwalk-combo combo_bounce_house_rentals [R=301,L]

RewriteBase /
RewriteRule ^policies faq [R=301,L]
RewriteRule ^about-us-moonwalk-rentals /  [R=301,L]
RewriteRule ^contact-us contact  [R=301,L]

I have an old domain name that I would like to redirect to my new domain and force https://www. The old domain name is

http(s)://webringtheparty.ourers.com/ 

and the new domain is

http(s)://(www.)webringtheparty.com/

I have setup

https://www.webringtheparty.com 

as the main entry in my search console so I would like to force this format on all requests.

The problem with my code is that if I have written the URL as

http://webringtheparty.ourers.com 

or

http://webringtheparty.com

and it redirects to the format that I want to force then no other RewriteRules are getting matched.


Here is the website I'm using to test the .htaccess rules:

https://htaccess.mwl.be/

Using the "Request URL" below and the .htaccess rules above I am expecting the "Expected Output URL" below, but it ends up as the "Actual Output URL" below:

Request Url: http://webringtheparty.ourers.com/about-us-moonwalk-rentals

Expected Output Url: https://www.webringtheparty.com/

Actual Output Url: https://www.webringtheparty.com/about-us-moonwalk-rentals

You need to login account before you can post.

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

© 2016 Powered by mzan.com design MATCHINFO