htaccess Elite

.htaccess tutorial


All times are UTC [ DST ]





Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: redirecting incoming url
PostPosted: Jun 25th, '08, 14:19 
Offline

Joined: Jun 25th, '08, 14:06
Posts: 1
I've done some research into this and cannot for the life of me, wrap my head around it...

I'm trying to redirect incoming urls ending with a .php extension to extensionless urls. I need the code to be generic as the .htaccess file will be used on separate websites.

trying to get http://website.com/file.php to look like http://website.com/file/

her is the code I thought would work, but doesn't:
Code:
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(.+)\.php/\ HTTP/
RewriteRule ^(.+)\.php/$ http://%{HTTP_HOST}/$1/ [R=301,L]


Here is what's in the .htaccess file already (this is needed for the CMS for the site):
Code:
<IfModule mod_php4.c>
php_value session.use_only_cookies 1
php_value session.use_trans_sid 0
</IfModule>

<IfModule mod_rewrite.c>
Options +FollowSymLinks

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* index.php [QSA,L]


</IfModule>


Any help for this newb would be appreciated.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 11 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB