I just can't find correct solution for what I need, so I hope someone will be able to help me here.
I now have website with this files:
/admin/
/images/
/js/
about.php
index.php
news.php
questions.php
So my URLs now are: www.mydomain.com/about.php www.mydomain.com/news.php ...
I would like to have www.mydomain.com/about/, www.mydomain.com/news/,...
I have tried many things which I found but none of them works like it should or it messes something else up.
The closest I got to is this:
RewriteRule about/ about.php
RewriteRule about about.php
But this also messes up if I use some image in code containing name about (example images/about-me.jpg) - probably because of second statement.
this worked for me
Enable mod_rewrite and .htaccess through
httpd.conf
and then put this code in your.htaccess
underDOCUMENT_ROOT
directory:To make life simpler I would stop using the directory based URL
/about/
and use a simpler file base URL
/about
That extra slash moves the page into a sub directory and all your relative references in the page will break.
Alternatively you can change all your links, includes and image URLs to make sure they all are relative to the root of the domain. You do this by always including a slash (/) before the URL or making them a full URL.
And make your rule more specific:
RewriteRule ^/about$ about.php
Those extra ^$ indicate start and end so it has to be an exact match.