Advertisement:

Author Topic: Redirect to homepage if the page doesnt excist  (Read 7691 times)

Offline sikkens1997

  • Jr. Member
  • **
  • Posts: 143
Redirect to homepage if the page doesnt excist
« on: May 06, 2011, 07:00:03 AM »
Hello, I wanna know how to make a redirect link to another page, if my visitors go to a page that does not excist.

Example: I go to www.mydomain.com/birthday and this page does not excist. How will I make it so, that they get redirected to the link www.mydomain.com/pagenotfound

And so with all the pages that does not excist, that they get redirected to the link www.mydomain.com/pagenotfound


I know I must do this in .htacces but i don't know what to put in there.

Offline gamesmad

  • SMF Hero
  • ******
  • Posts: 1,666
  • Gender: Male
Re: Redirect to homepage if the page doesnt excist
« Reply #1 on: May 06, 2011, 07:30:24 AM »
Create a file called ".htaccess" in your root folder and paste "ErrorDocument 404 /404.html" into it.

This will redirect any missing pages to "404.html", or any other page you like.
1 on 1 SMF Help - Want 1 on 1 SMF Help? Post in Help Wanted or drop me a message!

Go Charter! - Please consider becoming a charter member to support SMF development.

Please do not PM me with general questions, posting in the appropriate board will ensure everyone benefits from the advice given.

Offline sikkens1997

  • Jr. Member
  • **
  • Posts: 143
Re: Redirect to homepage if the page doesnt excist
« Reply #2 on: May 06, 2011, 08:56:07 AM »
Thanks :D

Offline gamesmad

  • SMF Hero
  • ******
  • Posts: 1,666
  • Gender: Male
Re: Redirect to homepage if the page doesnt excist
« Reply #3 on: May 11, 2011, 10:36:16 AM »
No worries, I will mark this one as solved :)
1 on 1 SMF Help - Want 1 on 1 SMF Help? Post in Help Wanted or drop me a message!

Go Charter! - Please consider becoming a charter member to support SMF development.

Please do not PM me with general questions, posting in the appropriate board will ensure everyone benefits from the advice given.

Offline sikkens1997

  • Jr. Member
  • **
  • Posts: 143
Re: Redirect to homepage if the page doesnt excist
« Reply #4 on: May 18, 2011, 09:34:06 AM »
Not solved. :(
I could not try this, since I didn't have the domain yet. Now I do.
When I go to FTP, and I put the file in there, it's there. When I reconnect or go to the site, It's not in there.

EDIT: It's because it's a secured file. I got in the File Manager and there it was.
Now I edited it like you said, excactly that but it doesn't work. :(

FINAL EDIT: It was because the page did not excist. It works totally fine now. Thanks <3

SOLVED
« Last Edit: May 18, 2011, 09:39:43 AM by sikkens1997 »

Online NanoSector

  • Support Specialist
  • SMF Hero
  • *
  • Posts: 9,952
  • Gender: Male
    • rick2288 on Facebook
    • Yoshi2889 on GitHub
    • Test Server
Re: Redirect to homepage if the page doesnt excist
« Reply #5 on: May 18, 2011, 09:44:02 AM »
Glad you got it solved! :)
My Mods / Mod Builder - A tool to easily create mods / Support team member
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."