Take the 2-minute tour ×
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 www.ictzorg.nl It will show the url www.ictzorg.nl in your browser which is originally www.ckc-seminars.nl/Event/ictzorg/2013/NL

This is the htaccess code

RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www.)?ictzorg.nl$
RewriteRule ^(.*)$ http://www.ckc-seminars.nl/Event/ictzorg/2013/NL/$1 [P]

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

www.ictzorg.nl/Event/ictzorg/2013/NL/Page/450

It should direct to

www.ckc-seminars.nl/Event/ictzorg/2013/NL/Page/450

and should be shown in the URL bar as

www.ictzorg.nl/Page/450
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
add comment

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 ictzorg.nl to http://www.ckc-seminars.nl/Event/ictzorg/2013/NL/. Fine, that works.

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

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

When it's clicked on, your rewrite rule then converts the www.ictzorg.nl to http://www.ckc-seminars.nl/Event/ictzorg/2013/NL/ again.

So the final url ends up having part repeated, like: http://www.ckc-seminars.nl/Event/ictzorg/2013/NL/Event/ictzorg/2013/NL/Page/451

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
add comment

Your Answer

 
discard

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.