Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2012-01-12 09:21:37

RedFox
Member
From: Netherlands
Registered: 2005-03-25
Posts: 819
Website

What to put into .htaccess to (re)direct incoming traffic to ...

… a subdirectory (folder) called www.something.nl … !?

Moving a new site from sub to root I did overwrite the existing .htaccess file … stupid me. Now two redirects doesn’t work anymore and I don’t know anything about this kind of .htaccess stuff.

The two subdirectories on the server are www.duodyade.nl and www.harp-duo.nl … because of my action these two domains will now be linked to the root e.g. www.marijevijselaar.nl

Or to put it in another way: originally the domain www.duodyade.nl was forwarded to http://www.marijevijselaar.nl/www.duodyade.nl … not anymore, because of overwriting the .htaccess file on the root www.marijevijselaar.nl. Does anyone know what kind of rules I’ve to put into the .htaccess file to restore the redirect?

[edit]
I did a post at stackoverflow too (I’m in a hurry!) > http://stackoverflow.com/…

#DirectoryIndex index.php index.html
#Options +FollowSymLinks
#Options -Indexes
#ErrorDocument 403 default
<IfModule mod_rewrite.c>
	RewriteEngine On
	#RewriteBase /relative/web/path/
	RewriteCond %{REQUEST_FILENAME} -f [OR]
	RewriteCond %{REQUEST_FILENAME} -d
	RewriteRule ^(.+) - [PT,L]
	RewriteCond %{REQUEST_URI} !=/favicon.ico
	RewriteRule ^(.*) index.php
	RewriteCond %{HTTP:Authorization}  !^$
	RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}]
#from stackoverflow > http://stackoverflow.com/questions/8834245/redirect-domain-to-a-subfolder-of-another-domain:
RewriteCond %{HTTP_HOST} ^www\.duodyade\.nl$
RewriteRule (.*) http://www.marijevijselaar.nl/www.duodyde.nl$1 [P]
</IfModule>
#php_value register_globals 0

… but it gives a 404 page … :(

Last edited by RedFox (2012-01-12 12:14:37)

Offline

#2 2012-01-12 12:17:27

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: What to put into .htaccess to (re)direct incoming traffic to ...

Similar to the answer you got at SO, try:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.duodyade\.nl$
RewriteRule (.*) http://www.marijevijselaar.nl/www.duodyde.nl$1 [R=301,L]

La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#3 2012-01-12 12:20:45

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: What to put into .htaccess to (re)direct incoming traffic to ...

BTW, if I go here:

www.marijevijselaar.nl/www.duodyde.nl

or here:

www.marijevijselaar.nl/www.duodyde.nl/

I got a 404.

Is there a /www.duodyde.nl/ subfolder in the root of the website?


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#4 2012-01-12 12:22:22

RedFox
Member
From: Netherlands
Registered: 2005-03-25
Posts: 819
Website

Re: What to put into .htaccess to (re)direct incoming traffic to ...

Hi @maniqui … thanks for helping me. We are almost there, I think, but your set of rules gives: http://www.marijevijselaar.nl/www.duodyde.nlindex.php … and so an error-default page!

BTW … the homepage is an index.html file!

[edit]
And yes … www.duodyade.nl is a folder and a subdirectory of marijevijselaar.nl

Last edited by RedFox (2012-01-12 12:25:26)

Offline

#5 2012-01-12 12:24:25

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: What to put into .htaccess to (re)direct incoming traffic to ...

I see now it’s redirecting from

http://www.duodyde.nl

to

http://www.marijevijselaar.nl/www.duodyde.nlindex.php

Put the new rule after the #RewriteBase /relative/web/path/ and before the TXP rules.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#6 2012-01-12 12:26:54

RedFox
Member
From: Netherlands
Registered: 2005-03-25
Posts: 819
Website

Re: What to put into .htaccess to (re)direct incoming traffic to ...

Sorry, it doesn’t work! I still get this url: http://www.marijevijselaar.nl/www.duodyde.nlindex.php

Last edited by RedFox (2012-01-12 12:27:40)

Offline

#7 2012-01-12 12:35:10

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: What to put into .htaccess to (re)direct incoming traffic to ...

Mmmmm.
Before going on, check that your rules and mines said “duodyde” instead of “duodyade”.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#8 2012-01-12 12:36:38

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: What to put into .htaccess to (re)direct incoming traffic to ...

I see this is the correct location we are trying to redirect to:

www.marijevijselaar.nl/www.duodyade.nl/


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#9 2012-01-12 12:37:33

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: What to put into .htaccess to (re)direct incoming traffic to ...

I’m getting a 404 at www.duodyade.nl/


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#10 2012-01-12 12:46:43

RedFox
Member
From: Netherlands
Registered: 2005-03-25
Posts: 819
Website

Re: What to put into .htaccess to (re)direct incoming traffic to ...

maniqui wrote:

Mmmmm.
Before going on, check that your rules and mines said “duodyde” instead of “duodyade”.

It does now … but it stil gives an error-default!

http://www.marijevijselaar.nl/www.duodyade.nl/ is working fine here!

Last edited by RedFox (2012-01-12 12:47:25)

Offline

#11 2012-01-12 12:56:03

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: What to put into .htaccess to (re)direct incoming traffic to ...

I see it’s working fine now.
www.duodyade.nl redirects to www.marijevijselaar.nl/www.duodyade.nl/

So, what was the issue? (it may help others!)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#12 2012-01-12 13:02:49

RedFox
Member
From: Netherlands
Registered: 2005-03-25
Posts: 819
Website

Re: What to put into .htaccess to (re)direct incoming traffic to ...

?? … because it’s not working (here) … www.duodyade.nl redirects to http://www.marijevijselaar.nl/www.duodyde.nlindex.php … and gives an error page!

Encore the .htaccess:

#DirectoryIndex index.php index.html
#Options +FollowSymLinks
#Options -Indexes
#ErrorDocument 403 default
<IfModule mod_rewrite.c>
	RewriteEngine On
	#RewriteBase /relative/web/path/
RewriteCond %{HTTP_HOST} ^www\.duodyade\.nl$
RewriteRule (.*) http://www.marijevijselaar.nl/www.duodyade.nl$1 [R=301,L]
	RewriteCond %{REQUEST_FILENAME} -f [OR]
	RewriteCond %{REQUEST_FILENAME} -d
	RewriteRule ^(.+) - [PT,L]
	RewriteCond %{REQUEST_URI} !=/favicon.ico
	RewriteRule ^(.*) index.php
	RewriteCond %{HTTP:Authorization}  !^$
	RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}]
</IfModule>
#php_value register_globals 0

Last edited by RedFox (2012-01-12 13:04:31)

Offline

#13 2012-01-12 13:05:49

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: What to put into .htaccess to (re)direct incoming traffic to ...

Are you using Chrome?
If so, clean your Chrome cache, because Chrome caches redirects (it took away a few hours of my life the first time I figured that out).


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#14 2012-01-12 13:16:29

RedFox
Member
From: Netherlands
Registered: 2005-03-25
Posts: 819
Website

Re: What to put into .htaccess to (re)direct incoming traffic to ...

%&%$%#&

Thanks @maniqui … your my savior … for today … ;-)

But … can you do one more trick? Now the url in the browserwindow of the redirect is: http://www.marijevijselaar.nl/www.duodyade.nl/ … can that be fixed to only www.duodyade.nl?

Last edited by RedFox (2012-01-12 13:28:48)

Offline

#15 2012-01-12 14:09:25

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: What to put into .htaccess to (re)direct incoming traffic to ...

You mean, to remove the trailing slash?

Being that it’s a real directory, you may want to check if this Apache directive works for you:

httpd.apache.org/docs/2.0/mod/mod_dir.html#directoryslash

Not sure exactly how it’s used.
You may want to try by creating (or using the existing one, if any) an .htaccess inside the /www.duodyade.nl/ folder and putting something like this:

DirectorySlash Off

Or

<Location />
DirectorySlash Off
</Location>

Or

<Directory />
DirectorySlash Off
</Directory>

To see if any of those works. Check that it doesn’t break other stuff, particularly inside the duadyade website.

This may also be achieved by some rewrite rules, but being that this is a real folder, I’m not sure if rewrite rules will take effect/precedence over the DirectorySlash directive.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB