

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
9 messages in ru.sysoev.nginxNeed help with converting this htacce...| From | Sent On | Attachments |
|---|---|---|
| Brian Zerangue | Feb 13, 2009 1:55 pm | |
| Brian Zerangue | Feb 13, 2009 1:59 pm | |
| Jim Ohlstein | Feb 13, 2009 2:44 pm | |
| Igor Sysoev | Feb 14, 2009 3:49 am | |
| Brian Zerangue | Feb 14, 2009 10:57 am | |
| Jim Ohlstein | Feb 14, 2009 11:30 am | |
| Brian Zerangue | Feb 14, 2009 10:21 pm | |
| Tobias lott | Feb 15, 2009 8:41 am | |
| Jim Ohlstein | Feb 15, 2009 10:06 am |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | Need help with converting this htaccess to nginx rewrite | Actions... |
|---|---|---|
| From: | Brian Zerangue (lis...@ruby-forum.com) | |
| Date: | Feb 13, 2009 1:55:53 pm | |
| List: | ru.sysoev.nginx | |
<p>I'm really interested in utilizing Nginx on my Slicehost account, but my main holdout is understanding how to adjust <code>.htaccess</code> files so that my site can function properly on Nginx.</p>
<p>I've made an attempt, but I'm just not a regular expressions guy and am new to this part altogether. Unfortuantely, I'm having a difficult time moving over to Nginx rewrite rules. I'll post my attempt at the Nginx rewrite rules, but first I'm going to post the mod_rewrite rules of my <a href="http://symphony21.com">Symphony CMS</a> site, so we have the direct comparison. If anyone knows Nginx... your help is much appreciated!!!</p>
<p>Here's the regular mod_rewrite for the index.php in document root folder for Symphony...</p>
<h3>Original Symphony 2 <code>.htaccess</code></h3>
<pre><code>### DO NOT APPLY RULES WHEN REQUESTING "favicon.ico" RewriteCond %{REQUEST_FILENAME} favicon.ico [NC] RewriteRule .* - [S=14]
### IMAGE RULES RewriteRule ^image\/3\/([0-9]+)\/([0-9]+)\/([1-9])\/([a-fA-f0-9]{3,6})(\/(0|1))?\/(.+)\.(jpg|gif|jpeg|png|bmp)$ /symphony/image.php?param=3:$1:$2:$3:$4:$6:$7.$8 [L] RewriteRule ^image\/2\/([0-9]+)\/([0-9]+)\/([1-9])(\/(0|1))?\/(.+)\.(jpg|gif|jpeg|png|bmp)$ /symphony/image.php?param=2:$1:$2:$3:0:$5:$6.$7 [L] RewriteRule ^image\/1\/([0-9]+)\/([0-9]+)(\/(0|1))?\/(.+)\.(jpg|gif|jpeg|png|bmp)$ /symphony/image.php?param=1:$1:$2:0:0:$4:$5.$6 [L] RewriteRule ^image(\/(0|1))?\/(.+)\.(jpg|gif|jpeg|png|bmp)$ /symphony/image.php?param=0:0:0:0:0:$2:$3.$4 [L]
### CHECK FOR TRAILING SLASH - Will ignore files RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !/$ RewriteCond %{REQUEST_URI} !(.*)/$ RewriteRule ^(.*)$ /$1/ [L,R=301]
### MAIN REWRITE - This will ignore directories RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)\/$ /index.php?page=$1&%{QUERY_STRING} [L] </code></pre>
<h3>My Nginx attempt</h3>
<p>I don't think this is right, but would love to get some input.</p>
<pre><code>location / { if ($request_filename="favicon.ico") { rewrite ^(.*)$ break; }
### IMAGE RULES rewrite ^image\/3\/([0-9]+)\/([0-9]+)\/([1-9])\/([a-fA-f0-9]{3,6})(\/(0|1))?\/(.+)\.(jpg|gif|jpeg|png|bmp)$ /symphony/image.php?param=3:$1:$2:$3:$4:$6:$7.$8 last; rewrite ^image\/2\/([0-9]+)\/([0-9]+)\/([1-9])(\/(0|1))?\/(.+)\.(jpg|gif|jpeg|png|bmp)$ /symphony/image.php?param=2:$1:$2:$3:0:$5:$6.$7 last; rewrite ^image\/1\/([0-9]+)\/([0-9]+)(\/(0|1))?\/(.+)\.(jpg|gif|jpeg|png|bmp)$ /symphony/image.php?param=1:$1:$2:0:0:$4:$5.$6 last; rewrite ^image(\/(0|1))?\/(.+)\.(jpg|gif|jpeg|png|bmp)$ /symphony/image.php?param=0:0:0:0:0:$2:$3.$4 last;
### CHECK FOR TRAILING SLASH - Will ignore files if (!-f $request_filename) { rewrite ^/(.+)$ /$1/ permanent; }
### MAIN REWRITE - This will ignore directories if (!-d $request_filename) { rewrite ^/(.+)$ /index.php?url=$1 last; } } </code></pre>
-- Posted via http://www.ruby-forum.com/.







