PDA

View Full Version : How do i Redirects users back to my forum?


Yellow Slider
07-05-2007, 07:17 AM
If a user will try to access http://www.mysite.net/notexits
and the file isn't exists, how can i redirect this user back to my site?
i don't want him to see the 404 file, in addition if some one is getting to my site with
http://mysite.net/ and i want him to access with the www, can i redirect that too?
I now that those options are available in vBSEO , but i don't want to use it..
i just need to add some lines in the .hataccess file, but what to put? i want it to fit to Google demands , about redirecting etc'..

Thanks a lot.

Dismounted
07-05-2007, 09:28 AM
You can't fit to Google's demands is you redirect back to the main page. Google wants a 404 status, but because the main page "exists", it gives back a 200 (OK) status.

Eikinskjaldi
07-05-2007, 10:41 AM
What dismounted said. Basically, dont mess with 404.

As for the other question, put this in your .htaccess


RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.mysite\.com [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^/(.*) http://www.mysite.com/$1 [L,R]

Yellow Slider
07-05-2007, 12:10 PM
how can i redirect back to the forum if the page doesn't exists?

and thanks.

Dismounted
07-05-2007, 12:26 PM
You said you want to adhere to Google. You can't do that if you redirect to the front page.

Yellow Slider
07-05-2007, 12:54 PM
Your are basically saying that Google won't allow to redirect back to the main page if a page doesn't exists ?

Dismounted
07-06-2007, 05:12 AM
Yes, because it gives back a 200 status. Google wants a 404 (Page Not Found). Otherwise, every page would "exist".