Home Backend Development PHP Tutorial Apache & nginx address rewrite url_rewrite, omit indexphp

Apache & nginx address rewrite url_rewrite, omit indexphp

Jul 28, 2016 am 08:29 AM
index request rewrite

<code><span>Apache</span> url_rewrite:

<span><span>LoadModule</span></span> rewrite_module modules/mod_rewrite.so
<span><IfModule mod_rewrite.c></span><span><span>RewriteEngine</span></span><span>on</span><span>RewriteBase</span> /

      <span><span>RewriteCond</span></span><span>%{REQUEST_FILENAME}</span> !-d
      <span><span>RewriteCond</span></span><span>%{REQUEST_FILENAME}</span> !-f
      <span><span>RewriteRule</span></span> ^(.*)$ index.php/<span>$1</span><span> [QSA,PT,L]</span><span>#RewriteRule ^(.*)$ index.php?$1 [QSA,L]</span><span></IfModule></span></code>
Copy after login
<code><span>Nginx</span> url_rewrite:

location / {
    <span>if</span> (!-e <span>$request_filename</span>) {
        <span>#一级目录</span>
        rewrite ^<span>/(.*)$ /index</span>.php/<span>$1</span> last;

        <span>#二级目录</span>
        rewrite ^<span>/public/</span>(.*)<span>$ </span>/public/index.php/<span>$1</span> last;
    }
}</code>
Copy after login
').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

以上就介绍了 Apache & nginx 的地址重写 url_rewrite,省略 indexphp,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What file is index.html? What file is index.html? Feb 19, 2024 pm 01:36 PM

index.html represents the home page file of the web page and is the default page of the website. When a user visits a website, the index.html page is usually loaded first. HTML (HypertextMarkupLanguage) is a markup language used to create web pages, and index.html is also an HTML file. It contains the structure and content of a web page, as well as tags and elements used for formatting and layout. Here is an example index.html code: &lt

What does php request mean? What does php request mean? Jul 07, 2021 pm 01:49 PM

The Chinese meaning of request is "request". It is a global variable in PHP and is an array containing "$_POST", "$_GET" and "$_COOKIE". The "$_REQUEST" variable can obtain data and COOKIE information submitted by POST or GET.

What is the Request object in PHP? What is the Request object in PHP? Feb 27, 2024 pm 09:06 PM

The Request object in PHP is an object used to handle HTTP requests sent by the client to the server. Through the Request object, we can obtain the client's request information, such as request method, request header information, request parameters, etc., so as to process and respond to the request. In PHP, you can use global variables such as $_REQUEST, $_GET, $_POST, etc. to obtain requested information, but these variables are not objects, but arrays. In order to process request information more flexibly and conveniently, you can

How to use the urllib.request.urlopen() function to send a GET request in Python 3.x How to use the urllib.request.urlopen() function to send a GET request in Python 3.x Jul 30, 2023 am 11:28 AM

How to use the urllib.request.urlopen() function in Python3.x to send a GET request. In network programming, we often need to obtain data from a remote server by sending an HTTP request. In Python, we can use the urllib.request.urlopen() function in the urllib module to send an HTTP request and get the response returned by the server. This article will introduce how to use

The role and significance of Request in PHP The role and significance of Request in PHP Feb 27, 2024 pm 12:54 PM

The role and significance of Request in PHP In PHP programming, Request is a mechanism for sending requests to the Web server. It plays a vital role in Web development. Request is mainly used to obtain data sent by the client, such as form submission, GET or POST request, etc. Through Request, the data input by the user can be obtained, and the data can be processed and responded to. This article will introduce the role and significance of Request in PHP and give specific code examples.

How nginx rewrite implements URL jump How nginx rewrite implements URL jump Jun 03, 2023 am 11:55 AM

URL jump The URL jump mentioned here is to jump to another URL when the user accesses one URL. A common application scenario is to let multiple domain names jump to the same URL (for example, let the old domain name jump to a new domain name), jump static file requests to CDN, etc. Jump to different sites according to the user's device (PC version) , wap version), etc. URL jump can be achieved by setting the window.location on the page with js or by setting the header with php. Of course, it can also be implemented using the rewrite function of nginx. The nginxrewrite module rewrite is the static rewrite module of nginx. The basic usage is rewritepattenre.

How to encapsulate Vue3 Axios interceptor into request file How to encapsulate Vue3 Axios interceptor into request file May 19, 2023 am 11:49 AM

1. Create a new file called request.js and import Axios: importaxiosfrom'axios'; 2. Create a function called request and export it: This will create a function called request and export it Set up a new Axios instance with a base URL. To add timeout settings in a wrapped Axios instance, you can pass the timeout option when creating the Axios instance. exportconstrequest=axios.create({baseURL:'https://example.

How to configure location and rewrite rules in Nginx How to configure location and rewrite rules in Nginx May 18, 2023 pm 12:25 PM

Location tutorial example: location=/{#Exact match/, the host name cannot be followed by any string [configurationA]}location/{#Because all addresses begin with /, this rule will match all requests#But regular and the longest string will be matched first [configurationB]}location/documents/{#Match any address starting with /documents/. After matching, continue to search downwards#Only when the subsequent regular expression is not matched, This article will use [configurationC]}location~/document

See all articles