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

Apache & nginx address rewrite url_rewrite, omit indexphp

WBOY
Release: 2016-07-28 08:29:09
Original
1026 people have browsed it

<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教程有兴趣的朋友有所帮助。

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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template