View Single Post
Old 10-07-2011, 11:31 PM  
acctman
Confirmed User
 
Join Date: Oct 2003
Location: Atlanta
Posts: 2,840
htaccess rewrite remove file extension?

anyone have an example of how to write url file extension

specific rewrite...
http://www.site.com/members.html to http://www.site.com/main

and then remove all extension for all files ending in *.html
http://www.site.com/*.html to http://www.site.com/*

also this needs to work with and without www

my current htaccess
Code:
<IfModule mod_rewrite.c>
RewriteEngine On		
RewriteCond %{HTTP_HOST} ^(ssss\.com)$ [NC] 
RewriteRule ^(.*)$ http://www.%1/$1 [R=301,L]
RewriteCond %{ENV:REDIRECT_STATUS} ^$ 
RewriteCond %{HTTP_HOST} !^(www\.)?ssss\.com$ [NC] 
RewriteCond %{HTTP_HOST} ^(www\.)?([^\.]+)\.ssss\.com$ [NC] 
RewriteRule ^(.*)$ http://www.ssss.com/view/%2.html [R=301,L]
RewriteCond %{REQUEST_URI} !^files/
RewriteCond %{REQUEST_FILENAME}  !-d
RewriteCond %{REQUEST_FILENAME}  !-f
RewriteRule ^(.*) index.php [L]
</IfModule>

Last edited by acctman; 10-07-2011 at 11:35 PM..
acctman is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote