Sign up ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

On our main domain we are running a CMS which feeds several domains with different input. The domains are directed with A records to the main ip address. The htaccess works fine it will bring up the right pages if you type in a url, lets say It will show the url in your browser which is originally

This is the htaccess code

RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www.)?$
RewriteRule ^(.*)$$1 [P]

Problem now is that if you click on a link on that page it will search for

It should direct to

and should be shown in the URL bar as
share|improve this question
I'm not sure that I follow? Isn't this dependent on how you are constructing the links on the page? – w3d Dec 29 '12 at 16:00
Hi, thats why I ask here I am really not into this. I seemed to me it must be doable with htaccess. there are always those 4 variables, Event/name_event/year/country What after the country name comes is always unique for each event. – juriaan waltmann Dec 29 '12 at 16:54

1 Answer 1

The rewrite rule you've written modifies both the domain, and the path, but you haven't updated the path in your page source.

You change to Fine, that works.

But the link in the page source is: /Event/ictzorg/2013/NL/Page/451.

As it's a relative link, (the current domain in the browser) gets added to the front of it.

When it's clicked on, your rewrite rule then converts the to again.

So the final url ends up having part repeated, like:

Solution: get rid of the /Event/ictzorg/2013/NL/ at the start of each URL in the source of the page (or with an extra rewrite rule), because your rewrite rule will put it back.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.