Forum Moderators: phranque
on my website, i want the urls to be displayed like the following:
http://www.example.com/contact/
instead of
http://www.example.com/contact.php
Also it should work when i write it with and without the forward slash at the end of the url
eg: http://www.example.com/contact/
and
http://www.example.com/contact
I want it all to be done through my .htaccess
thanks
on my website, I want the URLs to be displayed like the following:
For that to happen you need to link to those URLs on the pages of your site. It is links that 'define' URLs.
Also it should work when I write it with and without the forward slash at the end of the URL.
That creates two URLs for every piece of content.
I would suggest that you actually need a redirect to strip the slash off if there is request that includes the slash, and separately you need a rewrite which accepts a URL request without a trailing slash and fetches the content from inside the server.
I want it all to be done through my .htaccess
Let's see your code. You need to understand the code you write because this is server configuration code.
There are several threads in the last week that discuss what you need to do, and three other people have asked almost the same as this question just today.
here is my .htaccess content
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
actually this code i found on a different post yesterday which allows me to view the page without the its extention but the problem with it that it only workes without a slash at the end
eg: [domain.com...]
and when i type the link with the forward slash it gives me 404 error and as i mentioned in the origional post that i want the url to work with and without the slash if u get me.
Thanks
To do otherwise is to create duplicate content -- the same page content available at two different URLs. This is not seen kindly by search engines.
Please review our Forum Charter [webmasterworld.com] and the mod_rewrite and regular-expressions documents cited there. After doing so, post your best-effort code, and we'll be glad to answer specific questions.
Thanks,
Jim