Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
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
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]
Offline
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?
Offline
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
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.
Offline
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
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”.
Offline
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:
Offline
Re: What to put into .htaccess to (re)direct incoming traffic to ...
I’m getting a 404 at www.duodyade.nl/
Offline
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
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!)
Offline
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
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).
Offline
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
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.
Offline