将nginx规则转换为htaccess



有人可以帮助将这些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/(dddd-dd-dd) {
                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文件...重写规则下的所有内容 ^member/只是被忽略并且不起作用...((顺便说一下,它是cPanel/WHM ..我怀疑这是否有意义。阿帕奇是版本2。关于波纹管规则,我认为可以简化它们......一切都通过索引.php在这里,重点是使 PATH 中的几个子文件夹仅是 https。例如,http://www.example.com/member/下的所有内容都应该重写为 https://www.example.com/member/......

因此,如果有人可以帮助我提出以下条件...当出现在 URL/member/模式中时,它将被重定向到 https,那么这可能会解决我的问题。听起来REquest URI一直在包含索引.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/(dddd-dd-dd) /tools/Event/index.php?q=%{REQUEST_URI}&type=recap [L,QSA]

尝试:

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/(dddd-dd-dd) /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 配置中设置的文档根目录和索引。

最新更新