logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: mod_rewrite redirect
Author
Qmpeltaty



Joined: 06 Feb 2008
Posts: 182
Location: Poland

PostPosted: Wed 26 Jul '17 10:23    Post subject: mod_rewrite redirect Reply with quote

I have different languages' sites like
Code:
mydomain/en/mobile
mydomain/de/mobile


New mobile websites are coming and the url has changed from f.x. /en/mobile to /mobile/en , so i want to redirect just few pages, and later all to new link. I have such rule implemented for single language and it works :

Code:
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/en/mobile/(.*)$
RewriteRule (.*) https://%{HTTP_HOST}/mobile/en [L,R=301]


Now i need two rules - one which redirect all languages and one which redirects just few of them - f.x. en/de/fr should be redirected but others shouldn't be.
Back to top
Qmpeltaty



Joined: 06 Feb 2008
Posts: 182
Location: Poland

PostPosted: Wed 26 Jul '17 14:55    Post subject: Reply with quote

Here is what worked for my case :
Code:

RewriteRule ^/(en|de)/mobile(.*)$ https://%{HTTP_HOST}/mobile/$1 [L,R=301]
Back to top


Reply to topic   Topic: mod_rewrite redirect View previous topic :: View next topic
Post new topic   Forum Index -> Apache