有人可以帮助将这些nginx规则转换为htaccess吗?我正在寻找某种在线转换器,但没有运气......所有转换器都是htaccess-to-nginx((
我也找到了几个例子
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 ^ member /下面的所有东西都被忽略了并且不起作用...((通过它是cPanel / WHM的方式..我怀疑它是否有意义..Apache是版本2.关于波纹管规则我认为它们的mos可以简化......这里的一切都是通过index.php进行的,重点是在PATH中创建几个子文件夹仅限https。例如,http://www.example.com/member/下的所有内容都应重写为https://www.example.com/member/ ...
因此,如果有人可以帮助我制定以下条件......如果在URL /成员/模式中出现它将被重定向到https,那么这可能会解决我的问题。这听起来像REquest URI一直包括index.php,这阻止了一些规则的正常工作..不确定。 例如,重定向到/ member / search /我正在重定向到/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 :(得分: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配置中设置的文档根目录和索引。