- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我有这个问题,我以为我已经解决了,但我一直没能解决。我想重定向:
----------------------------------------------------------------------------
| FROM | TO |
----------------------------------------------------------------------------
| https://www.wknet.se/index.php | https://www.wknet.se/ |
----------------------------------------------------------------------------
我尝试添加:
location = /index.php {
return 301 https://www.wknet.se;
}
但随后它变成了浏览器中的重定向错误,并无限循环。这是我的配置:
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
server_name wknet.se www.wknet.se;
add_header Strict-Transport-Security max-age=15768000;
return 301 https://www.wknet.se$request_uri;
}
server {
listen 443 ssl;
server_name wknet.se;
ssl_certificate /etc/nginx/ssl/SSL.crt;
ssl_certificate_key /etc/nginx/ssl/KEY.key;
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ALL:!aNULL:!ADH:!eNULL:!LOW:!EXP:RC4+RSA:+HIGH:+MEDIUM;
ssl_prefer_server_ciphers on;
return 301 https://www.wknet.se$request_uri;
}
server {
listen 443 ssl;
server_name www.wknet.se;
root /var/www/wknet.se/html;
index index.php index.html index.htm;
ssl_certificate /etc/nginx/ssl/SSL.crt;
ssl_certificate_key /etc/nginx/ssl/KEY.key;
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ALL:!aNULL:!ADH:!eNULL:!LOW:!EXP:RC4+RSA:+HIGH:+MEDIUM;
ssl_prefer_server_ciphers on;
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location / {
try_files $uri $uri/ =404;
}
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 = /index {
return 301 https://www.wknet.se;
}
location ~ /\.ht {
deny all;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ~ /\. {
deny all;
error_log off;
log_not_found off;
}
location ~* .(jpg|jpeg|png|gif|ico|css|js)$ {
log_not_found off;
expires 365d;
}
location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|png|gif|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
access_log off;
log_not_found off;
expires max;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
location ~* \.(7z|ai|class|css|csv|ejs|eps|flv|html?|jar|jpe?g|js|json|lzh|m4a|m4v|mov|mp3|pdf|pict|pls|ps|psd|swf|tiff?|txt|webp)$ {
access_log off;
log_not_found off;
expires max;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
}
我用谷歌搜索并测试了一些我在互联网上找到的代码,但没有任何帮助。我错过了什么?
最佳答案
你最好的办法是在你的实际应用程序中删除所有指向 index.php
的链接,只提供任何特定的请求,包括 index.php
而不要试图改变它。
一旦您在应用程序中处理,应该很少甚至没有,因为搜索引擎将保存没有 index.php
的链接。
不确定你现在在哪里...
location = /index {
return 301 https://www.wknet.se;
}
... 位于事物的方案中(当然与您的 index.php 问题无关),也许应该删除它,因为它可能会导致您出现问题,除非您特别想要重定向 index
文件夹。
又是一刀。未经测试,但可能会打破循环。尝试在原始配置中的 error_page 500 502 503 504/50x.html;
下方添加此内容
# We need to check if the user has specifically requested "index.php"
# and only redirect if they have ($request_uri variable).
# Internal redirects ($uri variable) should be left alone to avoid a redirect loop.
if ( $request_uri ~ ^(/index\.php)$ ) {
return 301 https://www.wknet.se;
}
关于redirect - NGINX https ://www. example.com/index.php 到 https ://www. example.com/redirect 怎么办?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25974154/
我正在使用 nginx on Rackspace cloud following a tutorial并且已经搜索了网络,但到目前为止无法对此进行排序。 出于 SEO 和其他原因,我希望 www.my
我到处搜索并尝试了各种 .htaccess 配置,但没有找到答案。 只访问 .htaccess 文件我想: 将 NON www 定向到 NON www SSL示例:http://example.com
下面的 htaccess 命令将所有非 www 转移到 http www RewriteEngine On RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^
我希望重定向所有内容: http:// http://www. https://www. to https:// 这可能已经在这里得到了回答,但是在浏览了看起来相关的问题后,它们都不完全是我想要的,并
我有一个全新的网站,最初是 http://然后我将网站重定向到 http://www它的工作就像一个魅力,但自从我安装了 SSL 我有两个版本的网站 http://www.example.com和 h
我必须将我的网站从 https://www.example.com/ 重定向到 https://website.com/。 SSL 已正确安装在我的服务器上。 我正在使用 Apache 并且必须使用
我有一个 SEO 人员让我很困惑。他提到在 Google 网站管理员工具中,我应该验证网站的 www 版本以及非 www(非 www 已经验证)。所以我告诉他没有必要,因为出于规范原因(如 Matt
-- 请参阅下面的 Tl;dr 以获得简短版本-- 在我的 ubuntu-16.04 droplet apache2 和 php7 上都使用用户 www-data。在某些时候,所有三个 wordpre
Tumblr 的文档 ' Using a custom domain name ' 非常有帮助,它清楚地说明我需要创建一个 A唱片为 example.com指向 66.6.44.4 ,以便我的网站可以
我有一个托管在谷歌云存储桶上的静态网站。 在我的存储桶前面,我有 cloudflare dns。 存储桶是 example.com Cloudflare 设置:CNAME > @ > c.storag
我正在使用以下代码编写 www 到非 www 重定向: RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
我的一个 friend 目前正在修补 JpCap在 Java 中,我们发现了一些关于 Java 正则表达式的有趣(也许?)问题。 只有 HTTP 流量被捕获并随后进行分析。为此,他使用了如下模式: P
我目前在 htaccess 文件中使用以下代码,将我的服务器中托管的网站的所有非 www 网址重定向到 www 网址。 RewriteCond %{HTTP_HOST} !^www\. Rewrite
我有一个 wordpress 网站 www.domain.com,我们刚刚购买了一个 SSL 证书,但它只适用于 domain.com(没有 www)。我配置了 .htaccess 和站点 url R
我的 Apache 服务器上的虚拟主机中有以下内容, Redirect permanent / https://domain.com Options
我正在尝试将所有流量从 HTTP 站点重定向到 HTTPS 站点,并将所有 www 流量重定向到非 www 站点。我的设置包括 HTTP 站点的 nginx.conf 文件,我已将 301 重定向规则
关闭。这个问题是off-topic .它目前不接受答案。 想改进这个问题吗? Update the question所以它是on-topic用于堆栈溢出。 关闭 12 年前。 Improve thi
我有一个域说 http://www.testexample.com .当我登录 http://www.testexample.com然后回到http://testexample.com在浏览器中;登录
我正在为我的 Web 应用程序使用 EC2 实例。我买了一个新的 SSL 并将其安装在 AWS 经典负载均衡器上,我的 SSL 工作正常。但从 SEO 的角度来看,我想将所有请求从 www 和非 ww
这是否受跨源策略限制? 最佳答案 你不能。您只能向 www.foo.com 发送请求。 关于javascript - 在页面 'www.foo.com' 上,从 'www.example.com' 加
我是一名优秀的程序员,十分优秀!