Phalcon failed to use Apache to rewrite the module.

Source: Internet
Author: User
Initially contact with Phalcon and follow the official documentation to write code. The file structure is consistent with the official code {code ...} added in the root directory and public directory respectively. the htaccess File Code is as follows: {code ...} {code ...} enter localhosttutorial in the address bar of the browser according to the official document... first contact with Phalcon and follow the official documentation to write code
File structure is consistent with official

tutorial/  app/    controllers/    models/    views/  public/    css/    img/    js/

The. htaccess file is added to the root directory and the public directory respectively.
The Code is as follows:

./htaccess
  
       RewriteEngine on    RewriteRule  ^$ public/    [L]    RewriteRule  (.*) public/$1 [L]
  
./public/.htaccessAddDefaultCharset UTF-8
  
       RewriteEngine On    RewriteCond %{REQUEST_FILENAME} !-d    RewriteCond %{REQUEST_FILENAME} !-f    RewriteRule ^(.*)$ index.php?_url=/$1 [QSA,L]
  

Enter localhost/tutorial/in the address bar of your browser to access the public/index. php file.
However, if I enter localhost/tutorial, a message is displayed.

ForbiddenYou don't have permission to access /tutorial/ on this server.

You can directly enter localhost/tutorial/public/index. php for normal access or display this content.

My apache version is 2.4.10, And the configuration file has been changed

 DocumentRoot "/Users/anneason/www/"                                
  
   Options FollowSymLinks MultiviewsMultiviewsMatch AnyAllowOverride AllOrder deny,allowAllow from all
  

After modifying the access permission, the system still cannot access the database and prompts "no permission ".

How can I solve this problem? I have been troubled for a long time. Please help me. Thank you :)

Reply content:

First contact with Phalcon and follow the official documentation to write code
File structure is consistent with official

tutorial/  app/    controllers/    models/    views/  public/    css/    img/    js/

The. htaccess file is added to the root directory and the public directory respectively.
The Code is as follows:

./htaccess
  
       RewriteEngine on    RewriteRule  ^$ public/    [L]    RewriteRule  (.*) public/$1 [L]
  
./public/.htaccessAddDefaultCharset UTF-8
  
       RewriteEngine On    RewriteCond %{REQUEST_FILENAME} !-d    RewriteCond %{REQUEST_FILENAME} !-f    RewriteRule ^(.*)$ index.php?_url=/$1 [QSA,L]
  

Enter localhost/tutorial/in the address bar of your browser to access the public/index. php file.
However, if I enter localhost/tutorial, a message is displayed.

ForbiddenYou don't have permission to access /tutorial/ on this server.

You can directly enter localhost/tutorial/public/index. php for normal access or display this content.

My apache version is 2.4.10, And the configuration file has been changed

 DocumentRoot "/Users/anneason/www/"                                
  
   Options FollowSymLinks MultiviewsMultiviewsMatch AnyAllowOverride AllOrder deny,allowAllow from all
  

After modifying the access permission, the system still cannot access the database and prompts "no permission ".

How can I solve this problem? I have been troubled for a long time. Please help me. Thank you :)

OSX

Check whether mod_rewrite is enabled for phpinfo () by yourself.

It is found that the function is not enabled.

Enable and restart.

Thank you O (∩ _ ∩) O

I guess your apache version is 2.0;
If it is Apache 2.0 Handler; for example, Mac comes with this version;
Find httpd. conf under Apache and add the following section:

# use .htaccess files for overriding,AccessFileName .htaccess# and never show them
  
       Order allow,deny    Deny from all
  

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.