【发布时间】:2017-08-09 06:41:08
【问题描述】:
好的,这里很多。我最近更改了域名,我需要重定向很多东西。首先..
所有页面
需要重定向到
到目前为止,只有通过 cPanel 设置的主页重定向。
我还需要使用此 URL 重定向所有图像:
到
这是我目前的 htaccess。
Options -indexes
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all other URLs to index.php/URL
RewriteRule ^(.*)$ index.php?/$1 [L]
# RewriteCond %{HTTP_HOST} ^(www\.)?kaye\.at$
RewriteRule ^(.+\.png|gif|pdf|jpg|doc)$ http://helloarchie.co/$1 [NC,L,R]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 index.php
</IfModule>
RewriteCond %{HTTP_HOST} ^www\.helloarchie\.co [NC]
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
RewriteRule ^(.*)$ http://helloarchie.co/$1 [L,R=301]
<Files 403.shtml>
order allow,deny
allow from all
</Files>
【问题讨论】:
-
RewriteCond %{HTTP_HOST} ^(www\.)?kaye\.at$ RewriteRule ^(.+\.png|gif|pdf|jpg|doc)$ helloarchie.co/$1 [NC,L ,R] 仅重定向 png、git、pdf、jpg、doc 文件。那是你要的吗 ?有什么问题?
-
我已经更好地澄清了我的查询(希望如此)。
-
RewriteCond %{HTTP_HOST} ^www\.helloarchie\.co [NC] ==> 应该是 RewriteCond %{HTTP_HOST} ^www\.helloarchie\.blue [NC]
-
适用于主页,但不适用于单个页面,即。 helloarchie.blue/press
-
如果你删除了 3 "RewriteCond %{REQUEST_URI} ..." ?