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)
-   -   .htaccess masters, Help needed. (https://gfy.com/showthread.php?t=1078913)

freecartoonporn 08-23-2012 03:01 AM

.htaccess masters, Help needed.
 
hi all.,

how do i do this .,

i want to redirect all error/non existed pages to home page but not using

errodocumnet 404 thing

as it would show 404 in header.,

rather i want header to show
301 redirect.

how do i do that ?

so if i check header for nonexisted page link
like www.blahblah.com/nonexisted.html

it should thorw

HTTP/1.1 301 Moved Permanently

in header.


thanks for your time.

- Jesus Christ - 08-23-2012 03:28 AM

gfy "webmaster forum" lol
2 seconds on Google gets what you need

http://www.htaccessredirect.net/index.php

freecartoonporn 08-23-2012 05:12 AM

Quote:

Originally Posted by - Jesus Christ - (Post 19140799)
gfy "webmaster forum" lol
2 seconds on Google gets what you need

http://www.htaccessredirect.net/index.php

seriously?

You didnt read my post.
or am i missing something here ?

David Petters 08-23-2012 05:19 AM

ErrorDocument 404 /index.php

AdultKing 08-23-2012 05:27 AM

You might as well use 404, as redirecting many pages back to the home page with 301 will give you no SEO benefit. The idea is to redirect individual old pages to individual new pages, unless you do that the SEO benefit is null.

If you really want to throw a 301 for every page you don't have on your site then do it in Perl or PHP using the guide here:

http://www.seoworkers.com/seo-articl...tml#modrewrite

- Jesus Christ - 08-23-2012 05:31 AM

Quote:

Originally Posted by freecartoonporn (Post 19140916)
seriously?

You didnt read my post.
or am i missing something here ?

I misunderstood becasue you're asking how to do something that is a very bad idea and should not be done, but here's how to redirect if a file does not exist...


Code:

# If requested resource exists as a file or directory, skip next rule
RewriteCond %{DOCUMENT_ROOT}/$1 -f [OR]
RewriteCond %{DOCUMENT_ROOT}/$1 -d
RewriteRule (.*) - [S=1]
#
# Else rewrite requests for non-existent resources to /index.php
RewriteRule (.*) /index.php [R=302,L]


I hacked someone else's code so double check it. I also made it 302 becasue 301 is a really really stupid idea in this situation.


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

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