How to get rid of annoying server.segmentfault in URLs in Apache-laravel

Source: Internet
Author: User
Many web frameworks have index.*-like entry files, while in Laravel they are server.php. The server.php in Laravel often appears in URLs compared to other frameworks, such as: The home page is http://localhost/, but when other pages are requested, the URL becomes http://localhost/server.php/some. Personally feel that this is not beautiful, development will encounter some path problems.

So I would like to ask if there is no way to remove the annoying ' server.php '. Here's the way I tried it:

I am following the online tutorial, first I modified the Apache httpd.conf (I use Wamp)
1, the next line of "Listen 80" adds "Rewriteengine on"

2, remove the LoadModule rewrite_module modules/mod_rewrite.so in front of the comments

3, add a new directory (directory already exists in the httpd.conf file, I'm not sure if it will be okay
Directory content:
Options Indexes FollowSymLinks
AllowOverride All
Order Deny,allow
Allow from all

4. Configure the. htaccess in the Laravel project file (the brackets are omitted because they cannot be displayed)
IfModule mod_rewrite.c Options +FollowSymLinks RewriteEngine OnIfModuleIfModule mod_rewrite.c RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ server.php/$1 [L]IfModule

5, add ' server ' = ' in app/config/local/app.php,
Here, the configuration is complete, but the problem is still, ' server.php ' does not disappear, the place where it appears, the addition of the place to add. As if all of the above configurations are invalid.

Has anyone tried to get rid of ' server.php '? Ask for doubts

Reply content:

Many web frameworks have index.*-like entry files, while in Laravel they are server.php. The server.php in Laravel often appears in URLs compared to other frameworks, such as: The home page is http://localhost/, but when other pages are requested, the URL becomes http://localhost/server.php/some. Personally feel that this is not beautiful, development will encounter some path problems.

So I would like to ask if there is no way to remove the annoying ' server.php '. Here's the way I tried it:

I am following the online tutorial, first I modified the Apache httpd.conf (I use Wamp)
1, the next line of "Listen 80" adds "Rewriteengine on"

2, remove the LoadModule rewrite_module modules/mod_rewrite.so in front of the comments

3, add a new directory (directory already exists in the httpd.conf file, I'm not sure if it will be okay
Directory content:
Options Indexes FollowSymLinks
AllowOverride All
Order Deny,allow
Allow from all

4. Configure the. htaccess in the Laravel project file (the brackets are omitted because they cannot be displayed)
IfModule mod_rewrite.c Options +FollowSymLinks RewriteEngine OnIfModuleIfModule mod_rewrite.c RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ server.php/$1 [L]IfModule

5, add ' server ' = ' in app/config/local/app.php,
Here, the configuration is complete, but the problem is still, ' server.php ' does not disappear, the place where it appears, the addition of the place to add. As if all of the above configurations are invalid.

Has anyone tried to get rid of ' server.php '? Ask for doubts

laravelIt is best to configure the virtual host itself, pointing directly to the index.php in the public
If you do not specify, you can look at this http://blog.segmentfault.com/xiaobeicn/1190000000460901.

Server.php is actually for PHP built-in server used when using Php-s localhost:9999 to open the built-in server will use server.php do a part of the URL-compatible work

The best deployment is also the official recommendation is to point the root path to public, the portal file is index.php
This can also avoid some security issues

http://blog.csdn.net/yingdynasty/article/details/49995371
No Sheha haha

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.