Printer Friendly Version Print this thread
Email this thread to a friend eMail this thread to a friend
Featured Web Site Template

Hundreds More at Free Site Templates.com!

Web Site Partners
Sponsored Links
Jet City Software
 
Whos Here ?
Reflects user activity within the last 5 minutes
Moderator(s): Dinkar, Logan
Member Message

darrens
Joined: May 27, 2004
# Posts: 182

View the profile for darrens Send darrens a private message

Posted: 2006-Nov-21 01:53
Edit Message Delete Message Reply to this message

Hi,

Want to move my site from url1 to url2.
Going to do this using 301's.

My question is ...
I have a handfull of pages that i want to set up individual 301's for
Example:
url1.com/index.php = url2.com/index.asp

I will do this for 6 pages but all of the other pages i just want to redirect to the new url ? how can i write this in my .htaccess?
I dont want to overide all of the individual 301's i set up but all of the 'less important' pages i want to just send to the new url?

thanks



SportsGuy
Staff
Joined: Aug 30, 2002
# Posts: 3603

View the profile for SportsGuy Send SportsGuy a private message

Posted: 2006-Nov-21 12:59
Edit Message Delete Message Reply to this message

Let's see if I can help on this one - hopefully the examples I'm going to provide will work for you. I have taken this code directly form one of my own, active htaccess files with 301s that I know currently work, so here goes...

#Disable .htaccess viewing from browser
<Files ~ "^.htaccess">
Order allow,deny
Deny from all
Satisfy All
</Files>

AddType application/x-httpd-php .htm .html .php
DirectoryIndex index.htm index.html index.php default.asp default.aspx
ErrorDocument 404 /error_docs/not_found.html
php_value include_path ".:/yourdomain.com/httpdocs/includes"
IndexIgnore *



RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.yourdomain.com [NC]
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301]

Redirect permanent /index.php http://www.yourdomain2.com/index.asp

Redirect permanent /page.php http://www.yourdomain2.com/page.asp


Now, I think those examples will work for you to redirect the individual 6 pages you want handled, though if someone sees an error, chime in here.

As for blanket redirecting the rest of the URLs, I"m not sure. I don't know if using a wildcard ( * ) in the htaccess code would accomplish this or not, as I've never tried.

Anyone have any thoughts on this part? I'm pre-coffee this morning and I want to say I can see a solution, but to be fair, it's beyond my mind's grasp at the moment... sad

PS - don't worry about the italics I've used, that's just to keep the URLs from showing as links here.



g1smd
Staff
Joined: Jul 28, 2002
# Posts: 10465

View the profile for g1smd Send g1smd a private message

Posted: 2006-Nov-21 13:38
Edit Message Delete Message Reply to this message

Put the specific redirects FIRST, so that you do not create a redirection chain.


You do not want to create this scenario:

domain.com/index.php --> www.domain.com/index.php --> www.otherdomain.com/index.asp

You will want each redirect to get to the final location in just one move. You can also add [L] to the redirect code to tell the system not to process any more of the code if a match has already been made.



However, one major point. You should not be referring to "index.asp" at all. You should always omit the index file filename from any link and from any redirect. Refer to just "www.domain.com/" and "www.domain.com/folder/".

It is then irrelevant what the index file filename actually is. This code is useful:

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.(html?¦php¦asp)\ HTTP/
RewriteRule ^(.*)index\.(html?¦php¦asp)$ http://www.domain.com/$1 [R=301,L]



[ Message was edited by: g1smd 11/21/2006 06:00 am ]




You are not permitted to post messages in this forum or topic, because of one or more of the following reasons:
  1. You have not yet logged in, or registered properly as a member
  2. You are a member, but no longer have posting rights.
  3. 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

New posts Forum is locked
© 1995  ·  iWeb, Inc  ·  DBA JimWorld Productions