GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   How do you redirect all 404 requests to a specific page, regardless of the subdomain? (https://gfy.com/showthread.php?t=733109)

Myst 05-14-2007 12:22 PM

How do you redirect all 404 requests to a specific page, regardless of the subdomain?
 
Anyone know how to do this?

Basically all 404 requests to *.domain.com/* goes to domain.com/404.html

Myst 05-14-2007 12:46 PM

bumpbump

chris01282 05-14-2007 01:09 PM

RewriteEngine On
ErrorDocument 400 http://www.domain.com/404.html
ErrorDocument 401 http://www.domain.com/404.html
ErrorDocument 403 http://www.domain.com/404.html
ErrorDocument 404 http://www.domain.com/404.html
ErrorDocument 500 http://www.domain.com/404.html
ErrorDocument 501 http://www.domain.com/404.html
ErrorDocument 503 http://www.domain.com/404.html


copy this to a text file in the root of all domains/sub domains that you want to redirect 404 traffic from and rename it to .htaccess

or do the same and just use the "ErrorDocument 404" line from above

that should do it, or someone here will correct me :thumbsup

EBORG9 05-14-2007 01:23 PM

I have this in my .htacess file:
_____________________________________
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond &#37;{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
__________________________________
Where exactly would you put this, to make it function properly, before, or after?

Myst 05-14-2007 01:57 PM

Quote:

Originally Posted by chris01282 (Post 12427118)
RewriteEngine On
ErrorDocument 400 http://www.domain.com/404.html
ErrorDocument 401 http://www.domain.com/404.html
ErrorDocument 403 http://www.domain.com/404.html
ErrorDocument 404 http://www.domain.com/404.html
ErrorDocument 500 http://www.domain.com/404.html
ErrorDocument 501 http://www.domain.com/404.html
ErrorDocument 503 http://www.domain.com/404.html


copy this to a text file in the root of all domains/sub domains that you want to redirect 404 traffic from and rename it to .htaccess

or do the same and just use the "ErrorDocument 404" line from above

that should do it, or someone here will correct me :thumbsup

I tried it but it wont redirect all subdomains too..
domain.com/* -> 404.html works
*.domain.com/ -> doesnt :)

borked 05-14-2007 01:58 PM

Quote:

Originally Posted by EBORG9 (Post 12427236)
I have this in my .htacess file:

Code:

<IfModule mod_rewrite.c>
RewriteEngine On

ErrorDocument 404 http://www.domain.com/404.html

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>


SmokeyTheBear 05-14-2007 02:02 PM

you need to setup wildcard subdomains

SmokeyTheBear 05-14-2007 02:04 PM

depending on your hoist its prob not setup that way by default so you will likely need to ask your host to setup wildcard subs

EBORG9 05-14-2007 02:10 PM

Quote:

Originally Posted by borked (Post 12427474)
Code:

<IfModule mod_rewrite.c>
RewriteEngine On

ErrorDocument 404 http://www.domain.com/404.html

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>


Excellent. Thanks.

ssp 05-14-2007 02:11 PM

I don't think the mod rewrite solution is the correct solution as it parses the headers as 200 instead of 404. This might look ok the the surfer but is technically incorrect and search engines won't like it much.

Correct me if I'm wrong.


All times are GMT -7. The time now is 08:12 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123