您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息
免费发信息
三六零分类信息网 > 银川分类信息网,免费分类信息发布

关于apache服务器rewrite

2024/5/20 14:15:05发布65次查看
我的目的是在地址栏输入的url:
http://localhost/project/shorturl/index.php/149ui3
自动重写为
http://localhost/project/shorturl/index.php?controller=jump&method=jemp&code=149ui3
apache中添加配置如下(apache2.conf):
# turn on rewrite engine options +followsymlinks rewriteengine on # more rules below rewriterule ^index.php/(.*)$ index.php?controller=jump&method=jump&code=$1 [qsa]
但是始终不能跳转,请问应该如何正确配置呢.
回复讨论(解决方案) 1.httpd.conf中rewrite模块是否正确开启
2.你写入的这个配置文件是否有效
我在ubuntu下,没有发现httpd.conf文件,主配置文件只有apach2.conf,另外现在的配置是这样的.
1.在/var/www/project/shorturl目录下建立一个.htaccss文件内容如下:
# turn on rewrite engineoptions +followsymlinksrewriteengine on# more rules belowrewriterule ^index.php/(.*)$ index.php?controller=jump&method=jump&code=$1 [qsa
2.在apach2.conf中做了如下配置:
options followsymlinks allowoverride all require all granted
别的没有做配置.现在的问题是这样的:
现在问题是每次输入http://localhost/project/shorturl/index.php/149ui3都会显示没有css样式控制的http://localhost/project/shorturl/index.php内容(地址栏还是http://localhost/project/shorturl/index.php/149ui3),不能跳转到http://localhost/project/shorturl/index.php?controller=jump&method=jemp&code=149ui3这个地址
1.httpd.conf中rewrite模块是否正确开启
2.你写入的这个配置文件是否有效
现在的如#2楼所示,不好意思回复错了.  问题解决了,总结一下:
问题描述:
我的目的是在地址栏输入的url:
http://localhost/project/shorturl/index.php/149ui3
自动重写为
http://localhost/project/shorturl/index.php?controller=jump&method=jump&code=149ui3
解决方案
1.在apach2.conf中做如下配置:
options followsymlinks
    allowoverride all
    require all granted
2.在/var/www/project/shorturl目录下建立一个.htaccss文件内容如下:    
# turn on rewrite engine                                                                        
rewriteengine on
# more rules below
rewritebase /
rewriterule ^index.php/(.*)$ http://localhost/project/shorturl/index.php?controller=jump&method=j    ump&code=$1 [l,r=301]
写在最后
没事的时候还得多看文档啊,感谢开源中国疯狂的蜗牛提供的思路.
银川分类信息网,免费分类信息发布

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录