Mobile app version of vmapp.org
Login or Join
Shakeerah822

: Htaccess rewriterule for aliasses 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

@Shakeerah822

Posted in: #Htaccess

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 ictzorg.nl It will show the url ictzorg.nl in your browser which is originally ckc-seminars.nl/Event/ictzorg/2013/NL
This is the htaccess code

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


Problem now is that if you click on a link on that page it will search for
ictzorg.nl/Event/ictzorg/2013/NL/Page/450

It should direct to
ckc-seminars.nl/Event/ictzorg/2013/NL/Page/450

and should be shown in the URL bar as
ictzorg.nl/Page/450

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Shakeerah822

1 Comments

Sorted by latest first Latest Oldest Best

 

@Angie530

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 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, 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 ictzorg.nl to www.ckc-seminars.nl/Event/ictzorg/2013/NL/ again.

So the final url ends up having part repeated, like: 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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme