urgido
05-14-2008, 11:51 AM
how i can remove the ".php" extension in url address bar using .htaccess but automatically??
ex: when user type: www.mysite.com/forum.php
and remove automatically the file extension to be: www.mysite.com/forum
o the address url bar :D
regards
abduraooft
05-14-2008, 01:04 PM
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
can serve www.mysite.com/forum.php for a request www.mysite.com/forum
(You may need to change all links accordingly)
nikos101
05-14-2008, 03:41 PM
Is it just me or is the htaccess stuff confusing, especially when different hosts don't allow certain htaccess commands
theMaster
05-16-2008, 05:15 PM
I wonder.....
My .htaccess is as follows;
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)\.htm $1.php [nc]
RewriteRule ^(.*)\.html $1.php [nc]
RewriteRule ^(.*)\.asp $1.php [nc]
RewriteRule ^locate.php index.php?section=locate
RewriteRule ^available.php index.php?section=available
RewriteRule ^news.php index.php?section=news
RewriteRule ^features.php index.php?section=features
RewriteRule ^extras.php index.php?section=extras
You can see what it's doing, but do I have create a new line for every 'section'? Or can it be done with a global wildcard?
theMaster
05-17-2008, 12:31 PM
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)\.htm $1.php [nc]
RewriteRule ^(.*)\.html $1.php [nc]
RewriteRule ^(.*)\.asp $1.php [nc]
RewriteRule ^locate.php index.php?section=locate
RewriteRule ^available.php index.php?section=available
RewriteRule ^news.php index.php?section=news
RewriteRule ^features.php index.php?section=features
RewriteRule ^extras.php index.php?section=extras
theMaster
06-06-2008, 03:07 PM
Still hoping that there is a way I can write a general rule.
Anyone?
Please!!!
Thanks.
David