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 www.thedailyjoke.co.uk i want to be able to add somthing onto the end of this url so 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.
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?
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
# 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]
I have a site with only one page, index.php
this address www.thedailyjoke.co.uk
i want to be able to add somthing onto the end of this url so 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.
This works as it should but can someone please help me with the rest of the code?
Many Thanks
Chris
Try adding a $ to the end of your first line: ^thedailyjoke.co.uk$ [NC]
THe code thats's already there just forces the address to be, http://www.mysite rather than http://mysite
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: