2014-12-19 166 views
0

有人可以幫助將這些nginx規則轉換爲htaccess嗎?我一直在尋找某種網絡轉換器,但沒有運氣的......所有的轉換器的htaccess到nginx的(((將nginx規則轉換爲htaccess

我還發現了幾個例子

 location ~*/member/(join|register|renew|upgrade) { 
       rewrite ^/(.*) https://www.SOME_DOMAIN1/$1  redirect; 
     } 
     location /events { 
       rewrite ^/(.*) https://www.SOME_DOMAIN1/$1  redirect; 
     } 
     location /university/view/ { 
       try_files $uri $uri/ /tools/CMS/index.php?q=$uri; 
     } 
     location ~ ^/workshops/city/ { 
       try_files $uri /tools/IntensiveWorkshop/iw_city.php?q=$uri&$args; 
     } 
     location ~ ^/event-recaps/(\d\d\d\d-\d\d-\d\d) { 
       try_files $uri $uri/ /tools/Event/index.php?q=$uri&type=recap; 
     } 
     location /blog { 
       try_files $uri $uri/ /3dpart/wordpress/index.php?q=$uri&$args; 
     } 
     location/{ 
       index index.php index.html; 
       root   /var/www/SOME_DOMAIN1; 
       try_files $uri $uri/ /index.php?url=$uri&$args; 
     } 

問題是stackoverflow不允許我把所有的代碼,我有那裏.. anywya這裏是我的htaccess文件...所有在RewriteRule ^成員/只是忽略,不工作......((順便說一句,它是cPanel/WHM ..我懷疑它使sence .. Apache是​​版本2。關於波紋管規則,我認爲它們的mos可以被簡化...一切都是通過index.php在這裏,重點是使幾個子文件夾在PATH中只能使用https。例如,所有在http://www.example.com/member/之下的東西都應該重寫爲https://www.example.com/member/ ...

所以如果有人可以幫我做出以下的條件...當URL/member/pattern出現時,它會被重定向到https,這樣會可能解決我的問題。這聽起來像REquest URI一直包括index.php,這阻止了一些規則的正確工作..不確定。 例如,而不是重定向到/件/搜索/我得到重定向到/index.php?url=/member/search/

RewriteEngine On 
Options +FollowSymlinks 

## protect .htaccess and everything that starts from a "." dot 
<FilesMatch "^\."> 
    Order allow,deny 
    Deny from all 
</FilesMatch> 

## http://nonwww redirects to http://www and https://nonwww redirects to https://www 
RewriteCond %{HTTP_HOST} !^www\. 
RewriteCond %{HTTPS}s on(s)| 
RewriteRule^http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] 

## everything goes through index.php 
RewriteBase/
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule^/index.php?url=%{REQUEST_URI} [L,QSA] 

# here is where it starts to ignore everything 
RewriteRule ^member/(join|register|renew|upgrade) https://www.DOMAIN%{REQUEST_URI} [L,R] 
RewriteRule ^events/ https://www.DOMAIN%{REQUEST_URI} [L,R] 
RewriteRule ^jobbank/post http://www.DOMAIN%{REQUEST_URI} [L,R] 
RewriteRule ^jobbank/createaccount https://www.DOMAIN%{REQUEST_URI} [L,R] 
RewriteRule ^techspeak/ http://www.DOMAIN/%{REQUEST_URI} [L,R] 

RewriteRule ^newyork-ny http://www.DOMAIN%{REQUEST_URI} [L,R] 
RewriteRule ^longisland-ny http://www.DOMAIN%{REQUEST_URI} [L,R] 
RewriteRule ^sanfrancisco-ca http://www.DOMAIN%{REQUEST_URI} [L,R] 
RewriteRule ^losangeles-ca http://www.DOMAIN%{REQUEST_URI} [L,R] 
RewriteRule ^ralegh-nc http://www.DOMAIN%{REQUEST_URI} [L,R] 
RewriteRule ^portland-me http://www.DOMAIN%{REQUEST_URI} [L,R] 
RewriteRule ^chicago-il http://www.DOMAIN%{REQUEST_URI} [L,R] 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^blog /3dpart/wordpress/index.php?q=%{REQUEST_URI} [L,QSA] 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^university/view/ /tools/CMS/index.php?q=%{REQUEST_URI} [L,QSA] 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^workshops/city/ /tools/IntensiveWorkshop/iw_city.php?q=%{REQUEST_URI} 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^event-recaps/(\d\d\d\d-\d\d-\d\d) /tools/Event/index.php?q=%{REQUEST_URI}&type=recap [L,QSA] 

回答

0

嘗試:

RewriteEngine On 

RewriteRule ^member/(join|register|renew|upgrade) https://www.SOME_DOMAIN1%{REQUEST_URI} [L,R] 
RewriteRUle ^events https://www.SOME_DOMAIN1%{REQUEST_URI} [L,R] 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^university/view/ /tools/CMS/index.php?q=%{REQUEST_URI} [L,QSA] 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^workshops/city/ /tools/IntensiveWorkshop/iw_city.php?q=%{REQUEST_URI} [L,QSA] 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^event-recaps/(\d\d\d\d-\d\d-\d\d) /tools/Event/index.php?q=%{REQUEST_URI}&type=recap [L,QSA] 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^blog /3dpart/wordpress/index.php?q=%{REQUEST_URI} [L,QSA] 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule^/index.php?url=%{REQUEST_URI} [L,QSA] 

文檔根目錄和索引你可以在apache配置中設置。

+0

你能否檢查並更新信息? – 2014-12-19 16:24:53