Dynadot โ€” .com Registration $8.99

301 redirect question

Spaceship Spaceship
Watch
Impact
22
Hi,

I purchased a name that has a lot of backlinks and indexed pages in the search engines.

I know I should do a 301 redirect for the indexed pages, but the problem is that I don't know all the urls.

How do I redirect all indexed pages to my index page, without my current pages being redirected?

I created a site with about 8 pages and don't want those redirected to the index page.

Hope this makes sense.

Thanks for any help.

Dave
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
Hey,

I use htaccess to catch most of my haywire traffic...

RewriteBase /
RewriteEngine on

ErrorDocument 404 http://www.yoursite.com
ErrorDocument 401 http://www.yoursite.com
ErrorDocument 403 http://www.yoursite.com
ErrorDocument 405 http://www.yoursite.com
ErrorDocument 500 http://www.yoursite.com
ErrorDocument 302 http://www.yoursite.com
ErrorDocument 503 http://www.yoursite.com
ErrorDocument 406 http://www.yoursite.com
ErrorDocument 400 http://www.yoursite.com
ErrorDocument 423 http://www.yoursite.com
ErrorDocument 408 http://www.yoursite.com
ErrorDocument 204 http://www.yoursite.com
ErrorDocument 410 http://www.yoursite.com
ErrorDocument 206 http://www.yoursite.com
ErrorDocument 504 http://www.yoursite.com
ErrorDocument 202 http://www.yoursite.com
ErrorDocument 412 http://www.yoursite.com

Just drop that in your htaccess file in the root dir.

Enjoy.
 
0
•••
thank you greatdomainz
 
0
•••
Any time.
 
0
•••
A simpler way to do this is to use mod_rewrite. Put this in your .htaccess file:

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/$
RewriteRule ^(.*)$ / [R]

This is basically saying, if the request isn't for / (the root of the site), then redirect it back there with an external 301 (that's the [R] part).
 
0
•••
satchel said:
A simpler way to do this is to use mod_rewrite. Put this in your .htaccess file:

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/$
RewriteRule ^(.*)$ / [R]

This is basically saying, if the request isn't for / (the root of the site), then redirect it back there with an external 301 (that's the [R] part).
Wouldn't this redirect everything though?

He has a few live pages that he wants people to be able to get to I think.
 
0
•••
greatdomainz said:
Wouldn't this redirect everything though?
He has a few live pages that he wants people to be able to get to I think.
You're right! I didn't read carefully enough.
So in that case, just add a couple RewriteCond's to check if the file/dir exists:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/$
RewriteRule ^(.*)$ / [R]

Voila.
 
0
•••
satchel said:
You're right! I didn't read carefully enough.
So in that case, just add a couple RewriteCond's to check if the file/dir exists:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/$
RewriteRule ^(.*)$ / [R]

Voila.
Beautiful. :tu:
 
0
•••
Dynadot โ€” .com Registration $8.99Dynadot โ€” .com Registration $8.99
Unstoppable Domains
Domain Recover
DomainEasy โ€” Payment Flexibility
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back