我想要达到的目标
prod.com 将立即移至 prod.com/cms
当我做 Redirect permanent / /cms
我有很多 /cmscmscmscmscms 等。有什么想法吗?
我的虚拟主机
<VirtualHost *:443>
ServerName prod.com
DocumentRoot /home/www/sites/prod/html/development
<Directory /home/www/sites/prod/html/development>
AllowOverride All
</Directory>
SSLEngine on
SSLCACertificateFile /etc/pki/tls/certs/gd_bundle.crt
SSLCertificateFile /etc/pki/tls/certs/prod.crt
SSLCertificateKeyFile /etc/pki/tls/private/prod.key
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
BrowserMatch "MSIE [2-6]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
</VirtualHost>
我的.htaccess
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/API [NC]
RewriteRule ^(.*)$ /Application/API/api.php [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*)$ /Application/controller.php [L]
DirectoryIndex /Application/controller.php
您获得重定向循环的原因是因为
Redirect / /cms
匹配以 / 开头的任何路径并将旧路径附加到新路径。你真正想要的是:这只匹配 /