您好,欢迎访问一九零五行业门户网

thinphp apache url重写有关问题

thinphp apache url重写问题
例如:http://www.xxxx.com/index.php/index/index/n/50
把这个url重写成:
http://www.xxxx.com/50
而不影响其他模块
rewriterule ^(.*)$ index.php/$1 [qsa,pt,l] 这样只是把index.php去掉了,
访问首页的时候需要http://www.xxxx.com/50这样的效果
其他的还是:http://www.iwebo.dev/setting/index 
只是去掉index.php
写成这样:
rewriterule ^(.*)$ index.php/index/index/n/$1 [qsa,pt,l]
会影响全部模块的访问
  在纠结,还请各位帮忙看看...
------解决方案--------------------
options +followsymlinks +symlinksifownermatch
rewriteengine on
rewritecond %{request_filename} !-d 
rewritecond %{request_filename} !-f 
rewriterule (.*)$ index.php/$1 [l]
# turn on these settings to get a in yslow. :)
#
# expiresactive on
# expiresbytype image/gif a2592000
# expiresbytype image/jpeg a2592000
# expiresbytype image/png a2592000
# expiresbytype image/x-icon a2592000
# expiresbytype application/javascript a2592000
# expiresbytype application/x-shockwave-flash a2592000
# expiresbytype text/css a604800
#
#
#
# addoutputfilterbytype deflate text/html text/css application/javascript
#
#
# fileetag none
------解决方案--------------------
通常的url里面含有index.php,为了达到更好的seo效果可能需要去掉url里面的index.php ,通过url重写的方式可以达到这种效果,通常需要服务器开启url_rewrite模块才能支持。
下面是apache的配置过程,可以参考下:
1、httpd.conf配置文件中加载了mod_rewrite.so模块
2、allowoverride none 将none改为 all
3、确保url_model设置为2
4、把.htaccess文件放到入口文件的同级目录下
rewriteengine on
rewritecond %{request_filename} !-d
rewritecond %{request_filename} !-f
rewriterule ^(.*)$ index.php/$1 [qsa,pt,l]
其它类似信息

推荐信息