How to configure nginx with multiple domain names and remove index.php?

WBOY
Release: 2016-08-18 09:15:51
Original
1140 people have browsed it

nginx如果配置去掉index.php
location /{

if ($request_filename !~ (system|images|robots\.txt|index\.php.*) ) { rewrite ^/(.*)$ /mobile/index.php/$1 last; } }
Copy after login
Copy after login

这样是可以的

因为在网站根目录下 放了好几个目录 每个目录是不同的内容
我想分别都去掉这几个 mobile app restserver apph5这几个的url路径的index.php
改怎么配置啊

这里有
www----根目录

 ---mobile--- ---app--- ---restserver--- ---apph5--- 
Copy after login
Copy after login

回复内容:

nginx如果配置去掉index.php
location /{

if ($request_filename !~ (system|images|robots\.txt|index\.php.*) ) { rewrite ^/(.*)$ /mobile/index.php/$1 last; } }
Copy after login
Copy after login

这样是可以的

因为在网站根目录下 放了好几个目录 每个目录是不同的内容
我想分别都去掉这几个 mobile app restserver apph5这几个的url路径的index.php
改怎么配置啊

这里有
www----根目录

 ---mobile--- ---app--- ---restserver--- ---apph5--- 
Copy after login
Copy after login

if (!-e $request_filename) { rewrite ^/mobile/(.*)$ /mobile/index.php/$1 last; rewrite ^/app/(.*)$ /app/index.php/$1 last; rewrite ^/restserver/(.*)$ /restserver/index.php/$1 last; rewrite ^/apph5/(.*)$ /apph5/index.php/$1 last; }
Copy after login

if (!-e $request_filename) { rewrite ^(.*)$ /index.php?s=$1 last; break; } 
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!