Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 May 服务器中有两个域,a.com是我的主域,a.fr是我的重定向域。
我喜欢当用户输入时http://a.fr/dynamicpath/自动进入http://a.com/dynamicpath/,是否有可能通过这个来完成htaccess?
http://a.fr/dynamicpath/
http://a.com/dynamicpath/
htaccess
通过启用 mod_rewrite 和 .htaccess httpd.conf,然后将此代码放在您.htaccess的DOCUMENT_ROOT目录下:
httpd.conf
.htaccess
DOCUMENT_ROOT
Options +FollowSymLinks -MultiViews # Turn mod_rewrite on RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^(www\.)?a\.fr$ [NC] RewriteRule ^ http://a.com%{REQUEST_URI} [R=301,L]