Grow your CSS skills. Land your dream job.

This should be simple :(

  • # December 20, 2009 at 4:07 pm

    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

    # December 20, 2009 at 5:25 pm

    htaccess junk is never simple.

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

    # December 20, 2009 at 6:03 pm

    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

    # December 20, 2009 at 6:24 pm

    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)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".