Printer Friendly Version
Email this thread to a friend
|
Featured Web Site Template |
|
Reflects user activity within the last 5 minutes
|
|
| Member |
Message |
mishimainizu
Joined: Jan 19, 2006
# Posts: 32
|
Posted: 2006-Dec-25 06:56
Hello,
May I ask someone please to confirm whether the following Redirect 301 to move an entire folder to a different site is correct?
Redirect /folderA http: //www.newsite.com/folderA
What I want to do is moving all files contained in the current site's folderA to the new site's folderA, including the index.php file.
I would also need a suggestion: when I place the above instruction in the current site's .htaccess file, do I need to keep all folder files in place on the old server or can I remove them? And should I forbid the access to these files by SE crawlers by editing the robots.txt file?
Thanks very much in advance
Akira Mishima
|
 |
g1smd
Staff
Joined: Jul 28, 2002
# Posts: 10465
|
Posted: 2006-Dec-29 16:14
That code will generate a 302 response. You need a 301 instead.
The old files cannot be accessed, so they can be removed from the server.
When you ask for the old files the server immediately issues a redirect response, and never calls for, and never serves, the old files.
Try this:
Options +FollowSymlinks
RewriteEngine on
# Redirects for FolderA
RewriteCond %{HTTP_HOST} ^domain.com [NC]
RewriteRule ^/folderA/(.*)$ http://www.otherdomain.com/folderA/$1 [R=301,NC,L]
RewriteCond %{HTTP_HOST} ^www.domain.com [NC]
RewriteRule ^/folderA/(.*)$ http://www.otherdomain.com/folderA/$1 [R=301,NC,L]
# Canonicalisation for www.domain.com
RewriteCond %{HTTP_HOST} ^domain.com [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,NC,L]
On the other site I would also add:
# Index File canonicalisation
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]*/)*index\.(html?¦php)\ HTTP/
RewriteRule ^(([^/]*/)*)index\.(html?¦php)$ http://www.otherdomain.com/$1 [R=301,L]
so that you never mention the actual index file filename at all.
[ Message was edited by: g1smd 12/29/2006 08:30 am ]
|
 |
mishimainizu
Joined: Jan 19, 2006
# Posts: 32
|
Posted: 2006-Dec-30 07:05
Hi g1smd,
You have no idea what a great favour you did to me with these lines of code. They work splendidly. And what's also amazing is that there are still people like you around ready to help others with simple acts of generosity such as this one.
Thank you again indeed and best wishes for the new year.
Hm, I spoke too early. Actually, when I implemented these redirect instructions yesterday I forgot to remove the php redirect that I had manually included in each page while waiting to set up the htaccess redirect. When I remove the php redirect no redirection is made. The only part that seems to work is the www/non-www canonicalisation.
I doubled check and the htaccess redirect is made exactly as per your instructions. Do you have any idea why this is not working? Is there anything else that I should check?
Thank you and kind regards
[ Message was edited by: mishimainizu 12/30/2006 06:20 pm ]
|
 |
g1smd
Staff
Joined: Jul 28, 2002
# Posts: 10465
|
Posted: 2007-Jan-06 15:15
Make sure that your server is using Apache and that it really is fully enabled for redirects.
Use an online header checker or the Live HTTP Headers extension for Mozilla to see what is inside the HTTP headers returned by the server.
Check the order of the code used. It may be that the redirect code is never reached.
|
 |
mishimainizu
Joined: Jan 19, 2006
# Posts: 32
|
Posted: 2007-Jan-07 08:48
Hello g1smd,
Thank you for your reply. My server is using Apache and it is fully enabled. Everything is working fine except for the four redirects (folderI to folderI of the new site and folderE to the root of the new site, including their www counterpart as well). The www.domain.com canonicalization is working fine. Please also note that after the www.domain.com canonicalization there is another redirect (made from CPanel) plus a 404 error page.
Therefore, it seems that the four redirects are skipped. This is my current .htaccess file:
Options +FollowSymlinks
RewriteEngine on
# Redirects for FolderA
RewriteCond %{HTTP_HOST} ^domain.com [NC]
RewriteRule ^/folderI/(.*)$ http://www.otherdomain/folderI/$1 [R=301,NC,L]
RewriteCond %{HTTP_HOST} ^www.domain.com [NC]
RewriteRule ^/folderI/(.*)$ http://www.otherdomain.com/folderI/$1 [R=301,NC,L]
RewriteCond %{HTTP_HOST} ^domain.com [NC]
RewriteRule ^/folderE/(.*)$ http://www.othersite.com/$1 [R=301,NC,L]
RewriteCond %{HTTP_HOST} ^www.domain.com [NC]
RewriteRule ^/folderE/(.*)$ http://www.otherdomain.com/$1 [R=301,NC,L]
# Canonicalisation for www.domain.com
RewriteCond %{HTTP_HOST} ^aliseo.com [NC]
RewriteRule ^(.*)$ http://www.aliseo.com/$1 [R=301,NC,L]
# Index File canonicalisation
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9} /([^/]*/)*index.(htm?php) HTTP/
RewriteRule ^(([^/]*/)*)index.(htm?php)$ http://www.aliseo.com/$1 [R=301,L]
Did I do a mistake perhaps when combining all redirect instructions above?
Many thanks again for your time.
Kind regards
|
 |
You are not permitted to post messages in this forum or topic, because of one or more of the following reasons:
- You have not yet logged in, or registered properly as a member
- You are a member, but no longer have posting rights.
- This is a private forum, for which you do not have permissions.
If you are a recent member, it's possible that you simply have not yet confirmed your account. Please
check your email for a message entitled 'JimWorld Forums: Confirm Your Account' and follow the instructions
contained within.
If you cannot find this message, click here to Re-Send it.
|
If you are still experiencing problem, please read the
Login Assistance
Article for some advice on what may be causing your login not to work properly.
|
Switch to Advanced Editor and ...
Create a New Topic
or Reply to this Thread
|
|