0
我正在使用以下.htaccess代碼。htaccess www到非www不適用於子目錄
在根文件夾的.htaccess
#for redirecting www to non-www
RewriteCond %{HTTP_HOST} ^www\.(.*)
RewriteRule (.*) http://%1/$1 [R=301,L]
#temporary redirect root to dir/
RedirectMatch ^/$ /dir/
的.htaccess的dir夾
RewriteEngine on
#for changing index file to a custom one
DirectoryIndex abc.php?tag=ho
#for simple url
RewriteRule ^what/([^/]*)\.html$ /dir/abc.php?tag=$1 [L]
隨着當前代碼www.domain.com重定向到domain.com但www.domain.com/dir/不重定向。
我需要修改兩件事情:
- WWW重定向到非WWWW
- 重定向domain.com到domain.com/dir/
請指引我。
+1建議避免混合mod_alias和mod_rewrite。 – anubhava