.htaccess 页面在单击链接时被重定向,但在新选项卡上打开时不会重定向

.htaccess 页面在单击链接时被重定向,但在新选项卡上打开时不会重定向,.htaccess,redirect,browser-cache,.htaccess,Redirect,Browser Cache,奇怪的事情发生了(至少对我来说)。我有一个链接是 <a href="https://example.com/profile?code=533"> Name </a> 而不是 https://example.com/profile?code=533 当我右键单击链接,然后在新选项卡中打开时,正在新选项卡上加载正确的URL 我不知道发生了什么事。在这里尝试了所有类似的问题,所以,尝试禁用缓存,清除缓存。检查了.htaccess,但我没有发现任何问题,因为网站上的其他链接都

奇怪的事情发生了(至少对我来说)。我有一个链接是

<a href="https://example.com/profile?code=533"> Name </a>
而不是

https://example.com/profile?code=533
当我右键单击链接,然后在新选项卡中打开时,正在新选项卡上加载正确的URL

我不知道发生了什么事。在这里尝试了所有类似的问题,所以,尝试禁用缓存,清除缓存。检查了
.htaccess
,但我没有发现任何问题,因为网站上的其他链接都正常工作

这是我的
.htaccess

#Https redirection
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# Remove .php extension
RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}\.php -f 
RewriteRule ^(.*)$ $1.php

# redirect the blank request to the home page ( normally it is index.html )
RewriteCond %{REQUEST_URI} ^/$

# Remove WWW from URL and preserve http or https
RewriteCond %{HTTPS} =on
RewriteRule ^(.*)$ - [env=proto:https]
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ - [env=proto:http]

<ifModule mod_gzip.c>
    mod_gzip_on Yes
    mod_gzip_dechunk Yes
    mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
    mod_gzip_item_include handler ^cgi-script$
    mod_gzip_item_include mime ^text/.*
    mod_gzip_item_include mime ^application/x-javascript.*
    mod_gzip_item_exclude mime ^image/.*
    mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>

# BEGIN Expires
<ifModule mod_expires.c>
    ExpiresActive On
    ExpiresDefault "access plus 1 seconds"
    ExpiresByType text/html "access plus 1 seconds"
    ExpiresByType image/gif "access plus 604800 seconds"
    ExpiresByType image/jpeg "access plus 604800 seconds"
    ExpiresByType image/png "access plus 604800 seconds"
    ExpiresByType text/css "access plus 604800 seconds"
    ExpiresByType text/javascript "access plus 604800 seconds"
    ExpiresByType application/x-gzip "access plus 604800 seconds"
    ExpiresByType application/x-javascript "access plus 604800 seconds"

</ifModule>
# END Expires

# BEGIN Caching
<ifModule mod_headers.c>
    <filesMatch "\\.(ico|map|pdf|flv|jpg|jpeg|png|gif|swf)$">
    Header set Cache-Control "max-age=2592000, public"
    </filesMatch>
    <filesMatch “\\.(map)$”>
    Header set Cache-Control "max-age=604800, public"
    </filesMatch>
    <filesMatch "\\.(css)$">
    Header set Cache-Control "max-age=604800, public"
    </filesMatch>
    <filesMatch "\\.(js)$">
    Header set Cache-Control "max-age= 604800, private"
    </filesMatch>
    <filesMatch "\\.(xml|txt)$">
    Header set Cache-Control "max-age= 604800, public, must-revalidate"
    </filesMatch>
    <filesMatch "\\.(html|htm|php)$">
    Header set Cache-Control "max-age=1, private, must-revalidate"
    </filesMatch>
</ifModule>
# END Caching
#Https重定向
重新启动发动机
重写条件%{HTTPS}关闭
重写规则^(.*)$https://%{HTTP_HOST}%{REQUEST_URI}[L,R=301]
#删除.php扩展名
重新启动发动机
重写cond%{REQUEST_FILENAME}-D
重写cond%{REQUEST_FILENAME}\.php-f
重写规则^(.*)$$1.php
将该空白请求重定向到主页(通常它是索引x.html)。
重写cond%{REQUEST_URI}^/$
#从URL中删除WWW并保留http或https
RewriteCond%{HTTPS}=on
重写规则^(.*)-[env=proto:https]
重写cond%{HTTPS}=在…上
重写规则^(.*)-[env=proto:http]
mod_gzip_on Yes
是的
mod|gzip|item|u include file.(html?| txt | css | js | php | pl)$
mod_gzip_item_包含处理程序^cgi脚本$
mod_gzip_项目包括mime^text/*
mod_gzip_item_包括mime^application/x-javascript*
mod_gzip_项_排除mime^image/*
mod_gzip_item_排除rspheader^内容编码:.*gzip*
#开始过期
过期于
ExpiresDefault“访问加1秒”
ExpiresByType text/html“访问加1秒”
ExpiresByType image/gif“访问时间加604800秒”
ExpiresByType图像/jpeg“访问时间加604800秒”
ExpiresByType图像/png“访问时间加604800秒”
ExpiresByType文本/css“访问时间加604800秒”
ExpiresByType文本/javascript“访问时间加604800秒”
ExpiresByType应用程序/x-gzip“访问加604800秒”
ExpiresByType应用程序/x-javascript“访问时间加604800秒”
#期满
#开始缓存
标题集缓存控制“最大年龄=2592000,公共”
标题集缓存控制“最大年龄=604800,公共”
标题集缓存控制“最大年龄=604800,公共”
标题集缓存控制“最大年龄=604800,专用”
标题集缓存控制“最大年龄=604800,公共,必须重新验证”
标题集缓存控制“最大年龄=1,私有,必须重新验证”
#端缓存
在Chrome的开发者控制台中,当我点击链接时,我看到

状态代码:301永久移动

有什么问题吗


注意:我没有访问服务器的权限。只是指向站点文件。

也许PHP代码中有重定向?我没有看到任何重定向。此外,如果出现这种情况,则会影响新选项卡中的
打开链接
,但事实并非如此。首先,清除缓存,然后重试。然而,看看你的
.htaccess
你仅有的301重定向是针对HTTPs的,这不会导致这种情况。你检查了你的
httpd.conf
了吗?@Joe,我已经在我的浏览器上尝试了一切。不幸的是,我无法访问服务器,因此无法访问
httpd.conf
#Https redirection
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# Remove .php extension
RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}\.php -f 
RewriteRule ^(.*)$ $1.php

# redirect the blank request to the home page ( normally it is index.html )
RewriteCond %{REQUEST_URI} ^/$

# Remove WWW from URL and preserve http or https
RewriteCond %{HTTPS} =on
RewriteRule ^(.*)$ - [env=proto:https]
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ - [env=proto:http]

<ifModule mod_gzip.c>
    mod_gzip_on Yes
    mod_gzip_dechunk Yes
    mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
    mod_gzip_item_include handler ^cgi-script$
    mod_gzip_item_include mime ^text/.*
    mod_gzip_item_include mime ^application/x-javascript.*
    mod_gzip_item_exclude mime ^image/.*
    mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>

# BEGIN Expires
<ifModule mod_expires.c>
    ExpiresActive On
    ExpiresDefault "access plus 1 seconds"
    ExpiresByType text/html "access plus 1 seconds"
    ExpiresByType image/gif "access plus 604800 seconds"
    ExpiresByType image/jpeg "access plus 604800 seconds"
    ExpiresByType image/png "access plus 604800 seconds"
    ExpiresByType text/css "access plus 604800 seconds"
    ExpiresByType text/javascript "access plus 604800 seconds"
    ExpiresByType application/x-gzip "access plus 604800 seconds"
    ExpiresByType application/x-javascript "access plus 604800 seconds"

</ifModule>
# END Expires

# BEGIN Caching
<ifModule mod_headers.c>
    <filesMatch "\\.(ico|map|pdf|flv|jpg|jpeg|png|gif|swf)$">
    Header set Cache-Control "max-age=2592000, public"
    </filesMatch>
    <filesMatch “\\.(map)$”>
    Header set Cache-Control "max-age=604800, public"
    </filesMatch>
    <filesMatch "\\.(css)$">
    Header set Cache-Control "max-age=604800, public"
    </filesMatch>
    <filesMatch "\\.(js)$">
    Header set Cache-Control "max-age= 604800, private"
    </filesMatch>
    <filesMatch "\\.(xml|txt)$">
    Header set Cache-Control "max-age= 604800, public, must-revalidate"
    </filesMatch>
    <filesMatch "\\.(html|htm|php)$">
    Header set Cache-Control "max-age=1, private, must-revalidate"
    </filesMatch>
</ifModule>
# END Caching