本文介绍了htaccess的为WWW-仅重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有什么办法我也可以把我的网址,只使用 www.domain 代替的 domain ?
下面是我的htaccess,但不工作:
#打开URL重写 RewriteEngine叙述上 #安装目录 #的RewriteBase /测试/ 选项+的FollowSymLinks #被查看保护应用程序和系统文件 重写规则^(应用|模块|系统) - [F,L] #允许存在直接显示的任何文件或目录 的RewriteCond%{} REQUEST_FILENAME!-f 的RewriteCond%{} REQUEST_FILENAME!-d #重写所有其他URL的index.php / URL 重写规则。*的index.php / $ 0 PT,L] #redirec #detect网址加www 的RewriteCond%{HTTP_HOST} ^ thehotelinventory [NC] #REDIRECT到www,没有工作,虽然 重写规则^(。*)$ www.thehotelinventory/$1 [R = 301,L] AddHandler的PHP5脚本的.php解决方案
一个简单的答案可以在这里找到:的 snippets.dzone/posts/show/2264
Is there any way I can redirect my urls to only use www.domain instead of domain?
Here's my htaccess but doesnt work:
# Turn on URL rewriting RewriteEngine On # Installation directory # RewriteBase /test/ Options +FollowSymlinks # Protect application and system files from being viewed RewriteRule ^(application|modules|system) - [F,L] # 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/$0 [PT,L] #redirec #detect urls without www RewriteCond %{http_host} ^thehotelinventory [NC] #redirect to www, does not work though RewriteRule ^(.*)$ www.thehotelinventory/$1 [R=301,L] AddHandler php5-script .php解决方案
a simple answer can be found here: snippets.dzone/posts/show/2264
更多推荐
htaccess的为WWW
发布评论