How to remove the annoying server. SegmentFault in the URL in apache-laravel

Source: Internet
Author: User
Many web frameworks have entry files similar to index. *, while laravel is server. php. Compared with other frameworks, the server in laravel. php often appears in URLs. For example, the home page is localhost, but when other pages are requested, the URL becomes local... index is similar in many web frameworks. *, while laravel is a server. php. Compared with other frameworks, the server in laravel. php often appears in URLs. For example, the homepage is http: // localhost/, but when other pages are requested, the URL is changed to http: // localhost/server. php/some. I personally think this is not beautiful, and there will be some Path Problems during development.

So I want to ask if I can remove the annoying 'server. php '. The following describes the methods I have tried:

I followed the online tutorial. First, I modified httpd. conf of Apache (I used Wamp)
1. Add "RewriteEngine on" to the next line of "Listen 80"

2. removed the comments before LoadModule rewrite_module modules/mod_rewrite.so.

3. Add a new Directory (the Directory already exists in the httpd. conf file. I'm not sure if it will happen again.
Directory content:
Options Indexes FollowSymLinks
AllowOverride All
Order deny, allow
Allow from all

4. Configure. htaccess in the laravel project file (square brackets are omitted because it 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' => ''to app/config/local/app. php '',
At this point, the configuration is complete, but the problem persists. 'server. php' does not disappear. The location where it appears still appears, and the location where it should be added still needs to be added. As if all the above configurations are invalid.

Has someone tried 'server. php? Search for confusion

Reply content:

Many web frameworks have entry files similar to index. *, while laravel is server. php. Compared with other frameworks, the server in laravel. php often appears in URLs. For example, the homepage is http: // localhost/, but when other pages are requested, the URL is changed to http: // localhost/server. php/some. I personally think this is not beautiful, and there will be some Path Problems during development.

So I want to ask if I can remove the annoying 'server. php '. The following describes the methods I have tried:

I followed the online tutorial. First, I modified httpd. conf of Apache (I used Wamp)
1. Add "RewriteEngine on" to the next line of "Listen 80"

2. removed the comments before LoadModule rewrite_module modules/mod_rewrite.so.

3. Add a new Directory (the Directory already exists in the httpd. conf file. I'm not sure if it will happen again.
Directory content:
Options Indexes FollowSymLinks
AllowOverride All
Order deny, allow
Allow from all

4. Configure. htaccess in the laravel project file (square brackets are omitted because it 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' => ''to app/config/local/app. php '',
At this point, the configuration is complete, but the problem persists. 'server. php' does not disappear. The location where it appears still appears, and the location where it should be added still needs to be added. As if all the above configurations are invalid.

Has someone tried 'server. php? Search for confusion

laravelIt is best to configure the VM by yourself and direct it to index. php in public.
If you do not want to specify this parameter, check http://blog.segmentfault.com/xiaobeicn/1190000000460901.

Server. php is actually used for php built-in servers. When php-S localhost: 9999 is used to enable the built-in server, server. php is used for url compatibility.

The best deployment is also officially recommended to direct the root path to public, and the entry file is index. php.
This can also avoid some security issues.

Http://blog.csdn.net/yingdynasty/article/details/49995371
Thank you!

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.