Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End ulr

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #26883
    AlCapone
    Participant

    Hello again – need help with something else now =-)
    I have a site, so the homepage is ww.homepage.com (for example) and if a viewer comes to the site with this address ww.homepage.com/0789 then it stays on the home page but php reads the end number. I don’t want it to go to a 404 page, i want it to stay on the home page even though there is no 0789 page on my server.
    Can this be done and does anyone know of a tutorial that explains it – I tried searching on google but don’t really know what to search for…

    Many Thanks
    Chris

    *I removed a ‘w’ on the addresses of the made up links so they are not clickable

    #66932
    AshtonSanders
    Participant

    That was a little confusing, but it sounds like you want any and every possible URL on your website to load the same page (and then the PHP can decide what to do).

    You can do this with htaccess. (This is how most CMS’s create the SE-friendly URLS)

    Here’s the code from WordPress:

    Code:

    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]

    Basically what that does is check to see if the given file or directory exists, and if it doesn’t, load index.php.

    Warning: Make sure you do use 404 error headers if someone lands on a page that doesnt’ exist. Otherwise Google will think your entire website is thousands of pages that are exactly the same. (which, btw is spam.)

    #66957
    AlCapone
    Participant

    Oh, i don’t want to get in trouble with Google -I’ll try and explain it a bit better.
    So I’m making a Daily Joke Site.
    So the homepage shows today’s joke.
    But if someone wants to see yesterdays joke for example they can put the date after the web address.
    So, http://www.thedailyjoke.co.uk – THis will display todays joke and its the homepage.
    but, http://www.thedailyjoke.co.uk/19-11-2009 – This will display the joke from the 19th november 2009 – But there is not a page on my server with this name, i want the homepage to take this date and search a database for the correct joke (this is still on the homepage).
    I’m fine with most of it, i just don’t know how to get the homepage to take the extension url bit and store it as a variable and not try to find that page and redirect to a 404 page.

    Hope this was a better explanation for you to help me.

    Many Thanks
    Chris

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Back End’ is closed to new topics and replies.