Why is enabling REWRITE mode ineffective?

Source: Internet
Author: User
Why is enabling REWRITE mode ineffective? Http: // localhost/app/index. php/Login in the address bar, you can enter a webpage
Http: // localhost/app/. in this way, the webpage cannot be found and the address bar is changed to http: // localhost/app/Login.

Enter http: // localhost/app/index. php/Login to display the webpage

PHP version 5.5 ThinkPHP version 3.12

The content in. htaccess is:

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


LoadModule rewrite_module modules/mod_rewrite.so first # Removed, AllowOverride All also changed

'URL _ model' => 2 has been added to the config file.

Code:
Class IndexAction extends CommonAction {
Public function index (){

}
}

Header ('content-type: text/html; charset = utf-8 ');
// Public call non-execution class
Class CommonAction extends Action {

// Construct
Public function _ initialize (){
Echo 'script window. top. location. href = "'./index. php.'/Login"; script ';

}
}

Class LoginAction extends Action {

// Logon display page
Public function index (){

$ This-> display ('login ');
}
}

How can this problem be solved?


Reply to discussion (solution)

RewriteRule ^ (. *) $ index. php/$1 [QSA, PT, L]


I changed this

RewriteRule ^ (. *) $ index. php? S = $1 [QSA, PT, L]

This is why

However, my online search is basically the first type. I only see that someone once said this and I cannot tell why.

This indicates that you have not enabled path_info.
What is your Apache version? Why not enable it by default?

How can I enable phpstudy2014 and Apache 2.4.10?

This eldest brother, I tried the online method. it seems that path_info has enabled

Hmm
Http: // localhost/app/index. php/Login, indicating that path_info is enabled.

So why not your RewriteRule ^ (. *) $ index. php/$1 [QSA, PT, L?
This rewrite rule is
Http: // localhost/app/Login is changed to http: // localhost/app/index. php/Login.

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.