View Single Post
Old 07-30-2008, 07:27 AM  
acctman
Confirmed User
 
Join Date: Oct 2003
Location: Atlanta
Posts: 2,840
mod url rewrite expert needed

any mod rewrite experts on here? I'm trying to rewrite domain.com/view/USER.html to domain.com/USER and with trailing / this is the example I've been messing with RewriteRule ^/view\/(.*).html$ $1 [R] but no luck at getting it to work. below is my current rewrite

thanks in advance.

Code:
<IfModule mod_rewrite.c> 
RewriteEngine On       
RewriteBase / 

# force www    
RewriteCond %{HTTP_HOST} !^www\.domain\.com$ [NC] 
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L] 
# end www 
       
# start underscore -> dash conversion 
RewriteRule !\.(html|php)$ - [S=4] 
RewriteRule ^([^_]*)_([^_]*)_([^_]*)_([^_]*)_(.*)$ $1-$2-$3-$4-$5 [E=uscor:Yes] 
RewriteRule ^([^_]*)_([^_]*)_([^_]*)_(.*)$ $1-$2-$3-$4 [E=uscor:Yes] 
RewriteRule ^([^_]*)_([^_]*)_(.*)$ $1-$2-$3 [E=uscor:Yes] 
RewriteRule ^([^_]*)_(.*)$ $1-$2 [E=uscor:Yes] 
    
RewriteCond %{ENV:uscor} ^Yes$ 
RewriteRule (.*) http://www.domain.com/$1 [R=301,L] 
# end underscore 
    
RewriteCond %{REQUEST_FILENAME}  !-d 
RewriteCond %{REQUEST_FILENAME}  !-f 
RewriteRule ^(.*) index.php [L] 
</IfModule>
acctman is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote