.htaccess 在htaccess中重写而不隐藏文件名
我有一个网站,我正在重写URL以使用文件.htaccess 在htaccess中重写而不隐藏文件名,.htaccess,url,mod-rewrite,url-rewriting,.htaccess,Url,Mod Rewrite,Url Rewriting,我有一个网站,我正在重写URL以使用文件package.php,但URLhttp://example.com/package-type/airport/hotel-name。它在翻页时工作正常。然而,谷歌网站管理员工具正在报告URL的错误http://example.com/package.php?/package-类型/机场/酒店名称。为什么我的htaccess重写不能为谷歌工作?以下是我在htaccess文件中的重写代码: #Redirects hotel pages to package.
package.php
,但URLhttp://example.com/package-type/airport/hotel-name
。它在翻页时工作正常。然而,谷歌网站管理员工具正在报告URL的错误http://example.com/package.php?/package-类型/机场/酒店名称
。为什么我的htaccess重写不能为谷歌工作?以下是我在htaccess文件中的重写代码:
#Redirects hotel pages to package.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /package.php?/$1 [L]
# Removes package.php from ExpressionEngine URLs
RewriteCond %{THE_REQUEST} ^GET.*package\.php [NC]
RewriteCond %{REQUEST_URI} !/.* [NC]
RewriteRule (.*?)package\.php/*(.*) /$1$2 [R=301,NE,L]
任何帮助都将不胜感激。您的规则如下:
# Removes package.php from ExpressionEngine URLs
RewriteCond %{THE_REQUEST} /package\.php\?(\S+)\s [NC]
RewriteRule ^ /%1? [R=301,NE,L]
#Redirects hotel pages to package.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /package.php?/$1 [L,QSA]
你的规则是这样的:
# Removes package.php from ExpressionEngine URLs
RewriteCond %{THE_REQUEST} /package\.php\?(\S+)\s [NC]
RewriteRule ^ /%1? [R=301,NE,L]
#Redirects hotel pages to package.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /package.php?/$1 [L,QSA]
这看起来会奏效。但是我要到11月23日星期一才能测试它。看起来它会工作的。但我要到11月23日星期一才能测试它。