.htaccess 在 Linux(Debian) Apache2 中不起作用 [英] .htaccess Is Not working in Linux(Debian) Apache2

查看:37
本文介绍了.htaccess 在 Linux(Debian) Apache2 中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 apache2(我的虚拟服务器),它已经与我的 Debian 一起安装.一切都很好,但现在我的 .htaccess

I am using apache2 (my dummy server) which is already install with my Debian. Every thing goes fine, but now the problem with my .htaccess

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]

它不工作
我认为这是因为我使用的 apache2 版本 &可能是我的代码有问题,或者我必须在我的服务器上 config

It's not working
I think its because of apache2 version which am I using & maybe problems with my code or something I have to config on my server

如果我的网址输入错误或不可用,我想将其重定向到主索引页面

I want to redirect my url to main index page if its a wrong entry or unavailable

推荐答案

玩了一整天,我得到了答案

After spending a whole day, I got my answer

在文件夹中
apache2>>sites-available>> 有一个名为default

In Folder
apache2>>sites-available>> There is file called default

默认情况下我们必须更改它

In default we have to change it

发件人:

<Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
    </Directory>

到:

<Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
</Directory>

它的工作.它允许使用 .htaccess 文件.

Its working. It's enabled use of .htaccess files.

这篇关于.htaccess 在 Linux(Debian) Apache2 中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆