Forums

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

Home Forums Other This should be simple :(

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

    Hi, i have read about 10 different tutorials and searched the forums on this site to help me but i still can’t get it to work when everyone else makes it look so simple!
    I have a site with only one page, index.php
    this address http://www.thedailyjoke.co.uk
    i want to be able to add somthing onto the end of this url so http://www.thedailyjoke.co.uk/joke
    And the site goes to the index page rather than a 404 error page as the page does not exist.
    Now all the tutorials i have read say the same thing, use .htaccess file, but i can’t get it to work and i have no idea why.
    This is my .htaccess file at the moment.

    Code:
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^thedailyjoke.co.uk [NC]
    RewriteRule ^(.*)$ http://www.thedailyjoke.co.uk/$1 [L,R=301]

    This works as it should but can someone please help me with the rest of the code?

    Many Thanks
    Chris

    #68374
    JaredAM
    Member

    htaccess junk is never simple.

    Try adding a $ to the end of your first line: ^thedailyjoke.co.uk$ [NC]

    #68356
    AlCapone
    Participant

    Thanks for the reply – the code i have posted is the code that is already in my file, it all works perfectly its the other part that i mentioned originally that i can’t get to work.
    THe code thats’s already there just forces the address to be, http://www.mysite rather than http://mysite

    #68357
    JaredAM
    Member

    Ah, I must have misunderstood your original post.

    Here’s some code that I got to work for one of my sites which basically pointed the root address to a subfolder, maybe you can use something from it:

    Code:
    RewriteEngine on
    Options +FollowSymlinks
    RewriteBase /
    RewriteCond %{HTTP_HOST} ^(www.)?mysite.com$ [NC]
    RewriteCond %{REQUEST_URI} !^/mysitesubfolder/

    # Don’t change these lines.
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d

    # Change ‘subfolder’ to be the folder you will use for your main domain.
    RewriteRule ^(.*)$ /mysitesubfolder/$1 [L]

    # Change yourdomain.com to be your main domain again.
    # Change ‘subfolder’ to be the folder you will use for your main domain
    # followed by / then the main file for your site, index.php, index.html, etc.
    RewriteCond %{HTTP_HOST} ^(www.)?mysite.com$ [NC]
    RewriteRule ^(/)?$ mysitesubfolder/index.php [L]

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