301 redirect question

SpaceshipSpaceship
SpaceshipSpaceship
Namecheap AuctionsNamecheap Auctions
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
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
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
Close
thank you greatdomainz
 
0
Close
Any time.
 
0
Close
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
Close
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
Close
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
Close
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
Close
DomainEasy: white label portfolios are live. Enable yours.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back