htaccess的为WWW

编程入门 行业动态 更新时间:2024-10-28 20:18:22
本文介绍了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

本文发布于:2023-11-02 03:18:25,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1551226.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:htaccess   WWW

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!