Redirect 404

SpaceshipSpaceship
SpaceshipSpaceship
Namecheap AuctionsNamecheap Auctions
Watch

e39m5

Established Member
Impact
9
cpanel automatically sves as a .shtml. How can i redirect to my homepage iwth that extension?
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
Unstoppable Domains — AI StorefrontUnstoppable Domains — AI Storefront
i take it you mean you want the shtml site to be the 1 it goes to if someone types in www.domain.com

if so simply do the following:-

creat a text document and put the following into it (changing page.shtml to whatever the page is called):-

Code:
DirectoryIndex page.shtml

save the file as .htaccess (note nothing before the .) and upload it into your root folder. If you want other pages to be default page if that 1 does not exist just put a space at the end and add the next name.

More info can be found at http://httpd.apache.org/docs/howto/htaccess.html
 
0
•••
0
•••
0
•••
heh, im a n00b at this, wheres the htaccess file?
 
0
•••
e39m5 said:
heh, im a n00b at this, wheres the htaccess file?

It's a file named ".htaccess" in your www directory (public_html for cPanel servers).
 
0
•••
0
•••
Use:

Code:
ErrorDocument 404 yourscript.php

And in yourscript.php:

Code:
<?php
header("HTTP/1.0 301 Moved");
header("Location: index2.php");
?>

This way you will get indexed by sarch engines because the PHP script will remove the 404 error code.
 
Last edited:
0
•••
Michau said:
Use:

Code:
ErrorDocument 404 yourscript.php

And in yourscript.php:

Code:
<?php
header("HTTP/1.0 31 Moved");
header("Location: index2.php");
?>

This way you will get indexed by sarch engines because the PHP script will remove the 404 error code.
Nice Tip!
 
0
•••
OOps, one little mistake :( Should be "HTTP/1.0 301 Moved", not "HTTP/1.0 31 Moved".
 
0
•••
Truehost — .com domains from $4.99, hosting includedTruehost — .com domains from $4.99, hosting included

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com
Catchy
DomDB
NameFit
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back