E
E
EVOSandru62016-02-02 11:34:03
Yii
EVOSandru6, 2016-02-02 11:34:03

How to properly configure mod_rewrite for apache2 to work in Yii1?

Good afternoon!
Installed on debian apache + php + postgres
Registered hosts, added:
sudo a2enmod rewrite
sudo a2ensite hotel.conf
updatedb
locate mod_rewrite.so
cd /etc/apache2/mods-enabled
touch rewrite.load Registered

: in the above:
LoadModule rewrite_module /usr/lib /apache2/modules/mod_rewrite.so
000-default.conf :

<VirtualHost *:80>
        ServerAdmin [email protected]
   DocumentRoot /var/www/html
         <Directory />
             Options Indexes FollowSymLinks MultiViews
             AllowOverride all
             Order allow,deny 
             allow from all
      </Directory>
      <Directory /var/www/hotel/public_html>
             Options Indexes FollowSymLinks MultiViews
             AllowOverride all
             Order allow,deny
             allow from all
      </Directory>
   ErrorLog ${APACHE_LOG_DIR}/error.log
   CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

hotel.conf :
<VirtualHost *:80>
    ServerName hotel
    ServerAdmin [email protected]
    ServerAlias www.hotel
    DocumentRoot /var/www/hotel/public_html
    CustomLog ${APACHE_LOG_DIR}/hotel.access.log combined
    ErrorLog ${APACHE_LOG_DIR}/hotel.error.log
    AssignUserID andrey andrey
    DirectoryIndex index.php index.php4 index.php3 index.cgi index.pl index.html index.htm index.shtml index.phtml
    <Directory /var/www/example.com>
        Options -Includes -Indexes -ExecCGI
    </Directory>
</VirtualHost>

In the .htaccess file at the root of the site:
AddDefaultCharset utf-8
RewriteEngine on
RewriteBase /
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index .php
RewriteRule . index.php

The problem is that links like:
hotel/hotels/3
fly away to 404.
Only the main page of the site opens.
What could be the reason?
Earlier I sat on Windows with openserver and did not bother, but I decided to try to deploy the project on debian.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Osher, 2016-02-02
@EVOSandru6

Read The Following Manual .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question