在搜索了几个小时的互联网并且没有“导游”工作之后,我转向你们这些人和女孩寻求帮助。
我正在尝试清除任何目录中所有文件的所有网址,以便www.foo.com/foo.php成为www.foo.com/foo。
另外,我想整理www.foo.com/foo.php?foo=foo等请求到www.foo.com/foo/foo
这是我目前失败的尝试:
server {
# Change these settings to match your machine
listen 80 default_server;
server_name example.com www.example.com;
# Everything below here doesn't need to be changed
access_log /var/log/nginx/example.access.log;
error_log /var/log/nginx/example.error.log;
root /var/www/example.com;
try_files $uri $uri/ @extensionless-php;
index index.html index.htm index.php;
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
# The next two lines should go in your fastcgi_params
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location @extensionless-php {
rewrite ^(.*)$ $1.php last;
}
location /phpmyadmin {
root /usr/share/;
index index.php index.html index.htm;
location ~ ^/phpmyadmin/(.+\.php)$ {
try_files $uri =404;
root /usr/share/;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /usr/share/;
}
}
location /phpMyAdmin {
rewrite ^/* /phpmyadmin last;
}
}
它可以工作,但我仍然可以访问旧的.php网址,据我所知,这对SEO有害吗?作为其重复内容?
先谢谢 丹尼