我需要两件事
- 将所有请求从http://127.0.0.1重定向到http://127.0.0.1/cakephp
- 将所有请求从http://127.0.0.1/somefolder/someaction重定向到http://127.0.0.1/cakephp/somefolder/someaction
- 如果请求到此页面http://127.0.0.1/cakephp ,则不执行任何操作
我试过这个,但做不到。你能推荐正确的代码吗?
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ http://127.0.0.1/cakephp/$1 [R]
RewriteCond %{HTTP_HOST} ^127.0.0.1 [NC]
RewriteRule ^(.*)$ http://127.0.0.1/cakephp/$1 [L,R=301]