Linux “移动”;手工制作;htaccess-to-nginx-config
主要问题是由转换的代码不起作用。当尝试打开页面时,它只有白皮书,没有任何调试消息 已经有nginx配置:Linux “移动”;手工制作;htaccess-to-nginx-config,linux,wordpress,.htaccess,nginx,Linux,Wordpress,.htaccess,Nginx,主要问题是由转换的代码不起作用。当尝试打开页面时,它只有白皮书,没有任何调试消息 已经有nginx配置: server { location / { try_files $uri $uri/ /index.php?$args; rewrite ^/course-track/* https://website.com/profile/? redirect; rewrite ^/course-category/
server {
location / {
try_files $uri $uri/ /index.php?$args;
rewrite ^/course-track/* https://website.com/profile/? redirect;
rewrite ^/course-category/* https://websitw.com/profile/? redirect;
}
location /extra-online-testing/ {
rewrite ^(.*)$ https://website.com/tests/extra-online-testing/ redirect;
}
location = /my-courses/ {
rewrite ^(.*)$ https://website.com/profile/? redirect;
}
location = /courses/ {
rewrite ^(.*)$ https://website.com/profile/? redirect;
}
}
htaccess:
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/my-courses/$
RewriteRule ^.*$ https://website.com/profile/? [R=301,L]
RewriteCond %{REQUEST_URI} ^/course-track/*
RewriteRule ^.*$ https://website.com/profile/? [R=301,L]
RewriteCond %{REQUEST_URI} ^/courses/$
RewriteRule ^.*$ https://website.com/profile/? [R=301,L]
RewriteCond %{REQUEST_URI} ^/course-category/*
RewriteRule ^.*$ https://website.com/profile/? [R=301,L]
Redirect 301 /extra-online-testing/ https://website.com/tests/extra-online-testing/
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
重新编写引擎打开
重写COND%{REQUEST_URI}^/我的课程/$
重写规则^.*$https://website.com/profile/? [R=301,L]
重写COND%{REQUEST_URI}^/课程曲目/*
重写规则^.*$https://website.com/profile/? [R=301,L]
重写COND%{REQUEST_URI}^/课程/$
重写规则^.*$https://website.com/profile/? [R=301,L]
重写COND%{REQUEST_URI}^/课程类别/*
重写规则^.*$https://website.com/profile/? [R=301,L]
重定向301/额外在线测试/https://website.com/tests/extra-online-testing/
重新启动发动机
重写基/
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/index.php[L]
我尝试了另一个转换器,但得到了相同的结果 试试下面的代码:),如果对您有效,请告诉我:)
不。这不是工作。首先是因为它有三个“位置/”。我已经尝试将所有代码从localation/移动到文档的末尾,但没有任何帮助。
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /var/www/html;
index index.php index.html index.htm;
server_name your_domain.com;
location / {
# try_files $uri $uri/ =404;
try_files $uri $uri/ /index.php?q=$uri&$args;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
location = /my-courses/ {
rewrite ^(.*)$ https://website.com/profile/? redirect;
}
location / {
rewrite ^/course-track/* https://website.com/profile/? redirect;
rewrite ^/course-category/* https://website.com/profile/? redirect;
}
location = /courses/ {
rewrite ^(.*)$ https://website.com/profile/? redirect;
}
location /extra-online-testing/ {
rewrite ^(.*)$ https://website.com/tests/extra-online-testing/ redirect;
}
location / {
rewrite ^/course-category/* https://website.com/profile/? redirect;
}
}