0

我并试图让我们的网站重定向到资产库。所以 hexarmor.com/library 应该重定向到http://209.62.107.135/cgi-bin/ImageFolio43/imageFolio.cgi而不是你被送到http://209.62.107.135/cgi-bin/ImageFolio43/imageFolio.cgi/?/library/

添加会/library/引发 500 服务器错误。为什么这个变量与我的重定向一起传递,我该如何删除它?我在下面包含了我的整个 htaccess。感谢您的任何帮助,您可以提供。

RewriteEngine On
Redirect 301 /library http://209.62.107.135/cgi-bin/ImageFolio43/imageFolio.cgi
Redirect 301 /library/ http://209.62.107.135/cgi-bin/ImageFolio43/imageFolio.cgi

RewriteCond $1 !.(gif|jpe?g|png)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ /index.php?/$1 [L]

FileETag MTime Size
ExpiresActive On
<FilesMatch "\.(ico|jpg|jpeg|png|gif|js|css|swf)$">
ExpiresDefault "access plus 7 days"
</FilesMatch>

# gzip on Apache 2
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml text/javascript text/css application/x-javascript application/xhtml+xml application/javascript

# these browsers do not support deflate
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4.0[678] no-gzip
4

1 回答 1

0

在表弟的帮助下解决了这个问题。想我会努力帮助未来的访问者遇到类似问题。

以供参考

Redirect 301 /library http://209.62.107.135/cgi-bin/ImageFolio43/imageFolio.cgi
Redirect 301 /library/ http://209.62.107.135/cgi-bin/ImageFolio43/imageFolio.cgi

改为

RewriteRule ^library$ "http\:\/\/209\.62\.107\.135\/cgi\-bin\/ImageFolio43\/imageFolio\.cgi" [R=301,L]
RewriteRule ^library/$ "http\:\/\/209\.62\.107\.135\/cgi\-bin\/ImageFolio43\/imageFolio\.cgi" [R=301,L]

将重定向更改为重写规则,而不是在末尾设置 301 重定向标志。

[R=301,L]

目标 url 用引号括起来并用正斜杠转义。希望这可以帮助。

于 2012-07-26T16:33:11.040 回答