简体   繁体   中英

Url rewriting in apache2 not working

I am trying to rewrite url for my php application but its not working.

My directory structure

/var/www/html/test|
                  |---.htaccess
                  |---index.php

My .htaccess file content

# Activates URL rewriting (like myproject.com/controller/action/1/2/3)
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-l

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

apache2ctl -M result:

rewrite_module (shared)

Server version: Apache/2.4.18 (Ubuntu)

what i did wrong in the process? please help

Its Working fine now.

I just change my /etc/apache2/apache2.conf

<Directory /var/www/>
     Options Indexes FollowSymLinks
     AllowOverride None
     Require all granted
</Directory>

To

<Directory /var/www/>
     Options Indexes FollowSymLinks
     AllowOverride ALL
     Require all granted
</Directory>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM