301使用.htaccess进行网址重定向

时间:2019-12-10 06:19:03

标签: .htaccess

我正在使用htaccess将旧的URL重定向到新的URL,这些URL并没有按预期的方式重定向

htaccess

RewriteOptions inherit
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteCond $1 !^(index.php|resources|robots.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]


Redirect 301 /testing-url          /testing-link




## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 1 month"
</IfModule>
## EXPIRES CACHING ##

预期产量

www.example.com/testing-url来自www.example.com/testing-link

但是重定向的URL以以下方式重定向

www.example.com/testing-url?/testing-link

在使用Godaddy服务器时如何覆盖此问题?

0 个答案:

没有答案