...

View Full Version : .htaccess mod_rewrite



urgido
05-14-2008, 12:51 PM
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, 02: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, 04: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, 06: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-16-2008, 09:47 PM
Any help? PLEASE!!!!

odom4ever
05-17-2008, 07:42 AM
what's ur original .hta

theMaster
05-17-2008, 01: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
05-18-2008, 05:44 PM
any ideas?

theMaster
06-06-2008, 04:07 PM
Still hoping that there is a way I can write a general rule.

Anyone?

Please!!!

Thanks.

David



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum