Go Back   CodingForums.com > :: Client side development > General web building

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-14-2008, 11:51 AM   PM User | #1
urgido
Regular Coder

 
Join Date: Aug 2005
Posts: 257
Thanks: 8
Thanked 0 Times in 0 Posts
urgido is an unknown quantity at this point
.htaccess mod_rewrite

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

regards

Last edited by urgido; 05-14-2008 at 11:54 AM..
urgido is offline   Reply With Quote
Old 05-14-2008, 01:04 PM   PM User | #2
abduraooft
Supreme Master coder!

 
abduraooft's Avatar
 
Join Date: Mar 2007
Location: N/A
Posts: 14,680
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
abduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really nice
Code:
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)
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)
abduraooft is offline   Reply With Quote
Old 05-14-2008, 03:41 PM   PM User | #3
nikos101
Senior Coder

 
nikos101's Avatar
 
Join Date: Dec 2006
Location: London
Posts: 1,004
Thanks: 58
Thanked 10 Times in 10 Posts
nikos101 is an unknown quantity at this point
Is it just me or is the htaccess stuff confusing, especially when different hosts don't allow certain htaccess commands
__________________

nikos101 is offline   Reply With Quote
Old 05-16-2008, 05:15 PM   PM User | #4
theMaster
New Coder

 
Join Date: May 2008
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
theMaster has a little shameless behaviour in the past
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 is offline   Reply With Quote
Old 05-16-2008, 08:47 PM   PM User | #5
theMaster
New Coder

 
Join Date: May 2008
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
theMaster has a little shameless behaviour in the past
Any help? PLEASE!!!!
theMaster is offline   Reply With Quote
Old 05-17-2008, 06:42 AM   PM User | #6
odom4ever
New to the CF scene

 
Join Date: May 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
odom4ever is an unknown quantity at this point
what's ur original .hta
odom4ever is offline   Reply With Quote
Old 05-17-2008, 12:31 PM   PM User | #7
theMaster
New Coder

 
Join Date: May 2008
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
theMaster has a little shameless behaviour in the past
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 is offline   Reply With Quote
Old 05-18-2008, 04:44 PM   PM User | #8
theMaster
New Coder

 
Join Date: May 2008
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
theMaster has a little shameless behaviour in the past
any ideas?
theMaster is offline   Reply With Quote
Old 06-06-2008, 03:07 PM   PM User | #9
theMaster
New Coder

 
Join Date: May 2008
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
theMaster has a little shameless behaviour in the past
Still hoping that there is a way I can write a general rule.

Anyone?

Please!!!

Thanks.

David
theMaster is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:47 PM.


Advertisement
Log in to turn off these ads.