Skip to content
WJunction - Webmaster Forum

Blackhat 301 .htaccess Redirect

Status
Not open for further replies.
404error.gif


Most may not know but .htaccess redirect is better than the meta refresh or redirect tag because there is no delay as the browser reads the .htaccess file first. Here is how it works.

Go to your projects root directory, open the .htaccess file in your servers code editor or download to your local computer and edit it with any text editor. If you download the .htaccess file to your computer you may not see it,



you may want to double check your setting and make sure you have turn on invisible / system files.
Example:

PHP:
Redirect 301 / http://www.wareztunnel.com/301.php/
Redirect 404 / http://www.wareztunnel.com/404.php/
Code Breakdown


  • Redirect = Tells the browser what to do.
  • 301 or 404″ = Tells what error to redirect.
  • PHP:
    "http://www.wareztunnel.com/404.php/" = URL to redirect to.
  • Yes the / between the error value and URL does need to be there to separate the action from the event.
If you would like to understand more about the different types of page errors and there attributes,
please visit: List_of_HTTP_status_codes@Wikipedia.org

thank you :)


Credits to: IDocX D
 

5 comments

thanks for that... i would also add that 301 at htaccess is better than rel=canonical at meta page level.

a question thought...

What if i wanted to redirect any 404 pages to the homepage via a 301 redirect... do you know what that would look like?

Thanks for the breakdown above, nice post! helped me out today that and made me member of forum! B-)

iDCx
 
Status
Not open for further replies.

About the author

C
Active Member · Joined
i have no details about me :| Taking a good care of WJunction :D
6,106
Messages
592
Reactions
113
Points

Advertise on WJunction

Reach 1000's of webmasters, hosts & affiliates. Banner & sponsored-thread slots available.

Contact us
Back
Top Bottom