3

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
2
  • I'm not sure that I follow? Isn't this dependent on how you are constructing the links on the page?
    – MrWhite
    Dec 29, 2012 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. Dec 29, 2012 at 16:54

1 Answer 1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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