【发布时间】:2016-04-11 17:01:23
【问题描述】:
我有一个与 .htaccess 相关的问题,需要重定向帮助。
我有一个目录,其中保存了多个其他目录,其中一个是我的网站目录。
我的 .htaccess 文件已经设置为默认进入我的网站所在的子目录并显示 url,就好像它不在子目录中一样,即“reinhards.co/”,而不是“reinhards .co/reinhards.co"
# BEGIN WordPress
# In Root directory
# WPhtC: Disable directory browsing
Options All -Indexes
RewriteCond %{HTTP_HOST} ^(www.)?reinhards.co$
RewriteCond %{REQUEST_URI} !^/reinhards.co/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /reinhards.co/$1
RewriteCond %{HTTP_HOST} ^(www.)?reinhards.co$
RewriteRule ^(/)$ reinhards.co/index.php [L]
# END WordPress
但是,当有人输入时,我需要执行以下操作:
reinhards.co/xxxx
重定向到 reinhards.co/reinhards.co/xxxx ,但仍将 url 显示为 reinhards.co/xxxx
如果有人输入,我也很喜欢这个功能
reinhards.co/yyyy 重定向到 reinhards.co/reinhards.co/yyyy 因为这是一个有效的网页,但仍将网址显示为 reinhards.co/yyyy
【问题讨论】:
标签: php wordpress apache .htaccess redirect