简体   繁体   English

apache2中的网址重写不起作用

[英]Url rewriting in apache2 not working

I am trying to rewrite url for my php application but its not working. 我正在尝试为我的PHP应用程序重写url,但无法正常工作。

My directory structure 我的目录结构

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

My .htaccess file content 我的.htaccess文件内容

# 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: apache2ctl -M结果:

rewrite_module (shared)

Server version: Apache/2.4.18 (Ubuntu) 服务器版本: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 我只是更改了/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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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