# How to change apache .htaccess to nginx rewrite

**URL:** <https://www.ruby-forum.com/t/how-to-change-apache-htaccess-to-nginx-rewrite/186327>\
**Category:** NGINX\
**Created:** [April 5, 2010, 3:20am UTC](https://www.ruby-forum.com/t/how-to-change-apache-htaccess-to-nginx-rewrite/186327 "2010-04-05T03:20:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rangerangel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/958977/32.png) [@rangerangel](https://www.ruby-forum.com/u/rangerangel)\
**Post date:** [April 5, 2010, 3:20am UTC](https://www.ruby-forum.com/t/how-to-change-apache-htaccess-to-nginx-rewrite/186327/1 "2010-04-05T03:20:59Z")

</div>

## apache .htaccess

ExpiresActive On  
ExpiresByType image/gif “access 1 week”  
ExpiresByType image/jpg “access 1 week”  
ExpiresByType image/jpeg “access 1 week”  
ExpiresByType image/png “access 1 week”  
ExpiresByType text/css “access 1 week”  
ExpiresByType text/js “access 1 week”  
ExpiresByType application/x-shockwave-flash “access 1 week”  
ExpiresByType application/x-javascript “access 1 week”

ErrorDocument 404 [http://www.domain.com/](http://www.domain.com/)

RewriteEngine On  
RewriteCond %{ENV:REDIRECT\_STATUS} 200  
RewriteRule ^.\*$ - [L]  
RewriteRule ^index.php$ http://%{http\_host}/vb/ [R=301,L]

RewriteCond %{HTTP\_HOST} !^www.domain.com  
RewriteRule (.\*) [http://www.domain.com/vb/$1](http://www.domain.com/vb/$1) [L,R=301]

RewriteRule ^((urllist|sitemap).\*.(xml|txt)(.gz)?)$  
vbseo\_sitemap/vbseo\_getsitemap.php?sitemap=$1 [L]
