Thinkphp hides index. php after 500

Source: Internet
Author: User
Thinkphp hides index. php and later versions in linux + php5.3
Tp3.1.2

Modify the mod_rewrite.so module semicolon of httpd. conf according to the TP manual
Then there is AllowOverride None to change None to All (this place is in httpd. there are five items in the conf file. I changed them to All. I don't know if they are correct, or do I just need to modify them ?)

URL_MODEL is set to 2, which is also set to 2 in the configuration file. Then, write a. htaccess file in the root directory of the website. The content is as follows:


RewriteEngine on
RewriteCond % {REQUEST_FILENAME }! -D
RewriteCond % {REQUEST_FILENAME }! -F
RewriteRule ^ (. *) $ index. php/$1 [QSA, PT, L]


Then restart httpd, and the result is 500 Internal Server Error. at first, I thought it was my apache problem. Finally, I checked other websites and it was normal (this linux has multiple websites ), finally. after htaccess is deleted, the website becomes normal again. if there is another problem with htaccess, it can be explained. if there is a problem with htaccess, is there a problem with the content in it? you still need php. what about setting other ini parameters?



Reply to discussion (solution)

 
  
RewriteEngine on # if the directory exists, access the directory directly without RewriteRuleRewriteCond % {REQUEST_FILENAME }! -D # if the file exists, access the file directly without RewriteRule. (if the file does not exist or the file does not exist, rewrite it.) RewriteCond % {REQUEST_FILENAME }! -F # all files that cannot find the actual path should be handed over to index. php for RewriteRule ^ (. *) $ index. php/$1 [QSA, PT, L]
 

TP comes with. htaccess

Look at the http://blog.csdn.net/qq1355541448/article/details/21375407 here

 
  
RewriteEngine on # if the directory exists, access the directory directly without RewriteRuleRewriteCond % {REQUEST_FILENAME }! -D # if the file exists, access the file directly without RewriteRule. (if the file does not exist or the file does not exist, rewrite it.) RewriteCond % {REQUEST_FILENAME }! -F # all files that cannot find the actual path should be handed over to index. php for RewriteRule ^ (. *) $ index. php/$1 [QSA, PT, L]
 

TP comes with. htaccess

Look at the http://blog.csdn.net/qq1355541448/article/details/21375407 here



I set it according to the address of this BLOG, that is, it means that it should be set separately in httpd. conf, such as a website.

 
  
LoadModule rewrite_module modules/mod_rewrite.so // I wrote it here, ServerAdmin webmaster@dt.e.com DocumentRoot/web/xx.com ServerName xx.com ErrorLog logs/errun-error_log CustomLog logs/acrun-access_log common
 


Do I need to enable a module for a single website? cannot I configure it globally? I can restart httpd after following this modification, but an error is reported.


Then the problem persists ~

You only need one global one.



After the modification, the. htaccess file is not stored in the root directory of the website. as a result, 400 Bad Request is prompted when the root directory is set.


400 Bad RequestBad Request

Your browser sent a request that this server could not understand.



The homepage is 500, and the module I accessed just now shows 400,

Then, xx.com/index.php cannot be accessed.

You only need one global one.



I found the cause, which is the permission problem when I create. htaccess by default. because I am logged on as root, the permission to create this file is ROOT. I have set it
777 permission, but it is still the same. I just tried to change it to the user group and user of this website, and then refresh it.


Thank you, Xu,

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.