关于 php 伪静态的一个问题 我设置了伪静态例如 /abc/index.php 为 /index.html当我直接用域名 www.****.com 访问时,并不能读取这个 index.html请问高手要如何设置? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 http://hi.baidu.com/fengwz1/item/ab1fc193471f0b1d924f4119需要apache设置 不知道你是用什么方式实现的伪静态,如果是ubuntu_apache的话我是这么弄的 需要通过命令,或者自己重新创建个软连接才可以。命令是:sudo a2enmod rewrite软连接是:sudo ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/rewrite.load因为Ubuntu下,Apache的配置文件及目录结构不大一样,所以mods-avalilable下的是可用的模块,而真正启用了的模块是在mods-enable目录底下的。所以自己创建软连接也可以实现启用rewrite模块。除了启用rewrite外,还有地方需要修改的,如果你的站点只有一个,那修改/etc/apache2/sites-available /default这个文件就可以,如果你是虚拟主机的,那就修改自己的/etc/apache2/sites-available /www.orioner.net.conf(我的虚拟主机配置文件)这个文件了。Options FollowSymLinksAllowOverride None(修改为AllowOverride All)Options Indexes FollowSymLinks MultiViewsAllowOverride None(修改为AllowOverride All)Order allow,denyallow from all在你的网站的目录下建立.htaccess文件 并建立如下内容 RewriteEngine on RewriteBase / RewriteRule ^(.*)show-([0-9]+)-([0-9]+)\.html$ $1/show.php?itemid=$2&page=$3 其中RewriteRule是例子,意思为在浏览器中输入的是show-1-2.html,而实际访问的却是show.php?itemid=1&page=2 4.重启apache2 这样子说吧,我用的是 iis_rewriteRewriteRule ^(.*)/index\.html$ $1/abc/index\.php然后我输入域名: www.abc.com/ 这样访问不了 www.abc.com/inex.html 访问得了。怎么解决? RewriteRule ^/$ /abc/index\.php RewriteEngine onRewriteBase /RewriteCond %{HTTP_HOST} ^www.162100.com [NC]RewriteCond %{REQUEST_URI} ^/?$ [OR]RewriteCond %{REQUEST_URI} ^/index.php$ [NC]RewriteRule ^(index\.php|/?)$ index.php [L]#注意主机名写你自己的,或把它注释掉。 修正一下噢!因为你伪静态——地址栏输入的是index.html或直接输入网址RewriteEngine onRewriteBase /RewriteCond %{HTTP_HOST} ^www.162100.com [NC]RewriteCond %{REQUEST_URI} ^/?$ [OR]RewriteCond %{REQUEST_URI} ^/index.html$ [NC]RewriteRule ^(index\.html|/?)$ index.php [L]#注意主机名写你自己的,或把它注释掉。 RewriteRule ^index\.html$ - [L] 乖乖!你用的是iis_rewrite,这个不熟啊,只知道前面要加斜线:RewriteRule ^(/index\.html|/?)$ /index.php [I] UCenter与第三方程序挂接问题... 如何实现文件批量上传? 怎样提高dedecms网页打开速度 php循环读出同一天的更新日志 数据库字段 加减 的问题,在线等 APP网站怎么做 如何将数据发送给外部网站去查询,并返回外部网站的查询结果 数组长度相同,如何把一个数组的键名变成第二个数组的键值。 我安装discuz论坛出现了问题,请高人帮忙解答一下,谢谢! 如何配置Imgick 扩展 找不到错误啊!求高手指导 求个织梦新闻门户类的模板
需要apache设置
命令是:sudo a2enmod rewrite
软连接是:sudo ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/rewrite.load因为Ubuntu下,Apache的配置文件及目录结构不大一样,所以mods-avalilable下的是可用的模块,而真正启用了的模块是在mods-enable目录底下的。所以自己创建软连接也可以实现启用rewrite模块。除了启用rewrite外,还有地方需要修改的,如果你的站点只有一个,那修改/etc/apache2/sites-available /default这个文件就可以,如果你是虚拟主机的,那就修改自己的/etc/apache2/sites-available /www.orioner.net.conf(我的虚拟主机配置文件)这个文件了。Options FollowSymLinks
AllowOverride None(修改为AllowOverride All)
Options Indexes FollowSymLinks MultiViews
AllowOverride None(修改为AllowOverride All)
Order allow,deny
allow from all在你的网站的目录下建立.htaccess文件 并建立如下内容 RewriteEngine on RewriteBase / RewriteRule ^(.*)show-([0-9]+)-([0-9]+)\.html$ $1/show.php?itemid=$2&page=$3 其中RewriteRule是例子,意思为在浏览器中输入的是show-1-2.html,而实际访问的却是show.php?itemid=1&page=2 4.重启apache2
www.abc.com/inex.html 访问得了。怎么解决?
RewriteBase /RewriteCond %{HTTP_HOST} ^www.162100.com [NC]
RewriteCond %{REQUEST_URI} ^/?$ [OR]
RewriteCond %{REQUEST_URI} ^/index.php$ [NC]
RewriteRule ^(index\.php|/?)$ index.php [L]#注意主机名写你自己的,或把它注释掉。
RewriteBase /RewriteCond %{HTTP_HOST} ^www.162100.com [NC]
RewriteCond %{REQUEST_URI} ^/?$ [OR]
RewriteCond %{REQUEST_URI} ^/index.html$ [NC]
RewriteRule ^(index\.html|/?)$ index.php [L]#注意主机名写你自己的,或把它注释掉。