This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit

eZ Community » Forums » Install & configuration » Apache RewriteCond/Rule

Apache RewriteCond/Rule

Apache RewriteCond/Rule

Monday 05 October 2015 4:34:34 pm - 2 replies

I'm trying to do this:

All requests to* shall go to*

One (potential) problem here is that both and are ServerAlias(es) on the same Apache instance.

Background: We are using eZ Publish and need to redirect certain URLs from a mobile design to a "full" browser based design. We do not have responsive design so we are bound to use two different designs that matches host.

We do not do any redirects based on browser because we want the ability for the users to view both sites.

Tuesday 06 October 2015 1:02:36 am

So your rewrite conditions are:

if the hostname is
and if the URI is /path/*
redirect to*

if you're using .htaccess and want a 301 redirect it would look like this:

RewriteCond %{HTTP_HOST} x\.y\.com
RewriteRule ^(path/.*)$1  [R, L]

See for a more in-depth guide.

Wednesday 07 October 2015 9:58:06 am

Hey Geoff and thanks for pointing me in the right direction happy.gif Emoticon

After trying and failing a bit I came up with the following solution:


RewriteCond %{HTTP_HOST} new06\.neitileu\.no

RewriteRule   "^/test/(.+)"  "$1"  [R,L]

Works like a charm happy.gif Emoticon


You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from