简体   繁体   English

mod_rewrite隐藏网址的一部分

[英]mod_rewrite hid part of url

Hey guys, I did a bunch of google searching but I couldn't figure out how to get mod_rewrite working for my purpose. 大家好,我做了很多Google搜索,但我不知道如何让mod_rewrite发挥作用。

Here is my url: 这是我的网址:

http://localhost/symfony2/web/index.php

I would like to hide the web/index.php section so that this: 我想隐藏web/index.php部分,这样:

http://localhost/symfony2/web/index.php/hello/bob

turns to this: 变成这个:

http://localhost/symfony2/hello/bob

Nothing seems to be working right now. 现在似乎什么都没用。 It just keeps showing my folder structure. 它只是一直显示我的文件夹结构。 Here's what I currently have: 这是我目前拥有的:

RewriteCond %{REQUEST_URI} !web/
RewriteRule (.*) localhost/symfony2/web/index.php$1 [L]

(Also posted at http://forum.symfony-project.org/viewtopic.php?f=23&t=31361 .) (也发布在http://forum.symfony-project.org/viewtopic.php?f=23&t=31361 。)

RewriteBase /symfony2
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ web/index.php/$1 [L,QSA]

(The !-f and !-d are to make sure that if there is a file or directory match it won't rewrite it.) !-f!-d用于确保如果文件或目录匹配,则不会重写它。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM