View Single Post
Old 10-08-2011, 07:09 AM  
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,294
Quote:
Originally Posted by acctman View Post
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>
need more descriptive what you want.

but here is the basis


Quote:
Options +FollowSymLinks
RewriteEngine On

# which do you want?

# make /members.html use /main
RewriteRule ^members.html /main [NC]

# make /main use /members.html
RewriteRule ^main /members.html [NC]

# alias /filename.html to /filename (dont know if you want to redirect the .html to the non or just make it work without

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.+)$ $1.html [L,QSA]
hope this helps you out somewhat.
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote