如何检查服务器上是否启用了 mod_rewrite? [英] How to check whether mod_rewrite is enable on server?

查看:36
本文介绍了如何检查服务器上是否启用了 mod_rewrite?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我使用带有 lightspeed 服务器的主机.托管说 mod_rewrite 已启用,但我无法让我的脚本在那里工作.每当我尝试访问该 URL 时,它都会返回 404 - 未找到页面.

Currently I am using the hosting with lightspeed server. Hosting says mod_rewrite is enabled but I can't get my script working there. Whenever I try to access the URL, it returns 404 - not found page.

我将相同的代码放在另一台运行 Apache 的服务器上.它在那里工作.所以我想,这是 .htaccessmod_rewrite 的问题.

I put the same codes at another server which is running with Apache. It's working over there. So I guess, it's the .htaccess and mod_rewrite issue.

但是托管支持人员仍然坚持要求我启用他们的 mod_rewrite,所以我想知道如何检查它是否实际启用.

But Hosting support is still insisting with me that their mod_rewrite is on, so I would like to know how can I check whether it's actually enabled or not.

我尝试使用 phpinfo() 进行检查,但不幸的是,我在那里找不到 mod_rewrite,是不是因为他们使用的是 lightspeed?

I tried to check with phpinfo(), but no luck, I can't find mod_rewrite there, is it because they are using lightspeed?

有什么办法可以查到吗?请帮帮我.谢谢.

Is there any way to check? Please help me out. Thank you.

仅供参考:我的.htaccess代码是

Options -Indexes

<IfModule mod_rewrite.c>
DirectoryIndex index.php
RewriteEngine on

RewriteCond $1 !^(index.php|assets|robots.txt|favicon.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]
</IfModule>

我也这样试过

DirectoryIndex index.php
RewriteEngine on

RewriteCond $1 !^(index.php|assets|robots.txt|favicon.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]

但同样的结果.

推荐答案

从命令行输入

sudo a2enmod 重写

sudo a2enmod rewrite

如果重写模式已经启用,它会告诉你!

if the rewrite mode is already enabled, it will tell you so!

这篇关于如何检查服务器上是否启用了 mod_rewrite?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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