如何检查的mod_rewrite是否能在服务器上? [英] How to check whether mod_rewrite is enable on server?

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

问题描述

目前我使用的主机是光速服务器。托管称的mod_rewrite 已启用,但我不能让我的剧本在那里工作。每当我试图访问的URL,它返回的 404 - 找不到网页

我把同样的codeS在一个与Apache的运行另一台服务器。它的工作在那里。所以我想,这是的.htaccess 的mod_rewrite 的问题。

但主机的支持,仍坚持我说,他们的mod_rewrite的是对的,所以我想知道我怎么能检查的mod_rewrite是否启用。

我试图检查与phpinfo()函数,但没有运气,我不能找到的mod_rewrite ,它是不是他们使用的,因为光速

反正是有检查?请帮助我。谢谢你。

供参考:的.htaccess code是

选项-Indexes

 < IfModule mod_rewrite.c>
的DirectoryIndex index.php文件
RewriteEngine叙述上

!的RewriteCond $ l ^(指数\ .PHP |资产|机器人\ .TXT |图标\ .ICO)
的RewriteCond%{} REQUEST_FILENAME!-f
的RewriteCond%{} REQUEST_FILENAME!-d
重写规则^(。*)$ ./index.php/$1 [L,QSA]
< / IfModule>
 

我想这样也

 的DirectoryIndex index.php文件
RewriteEngine叙述上

!的RewriteCond $ l ^(指数\ .PHP |资产|机器人\ .TXT |图标\ .ICO)
的RewriteCond%{} REQUEST_FILENAME!-f
的RewriteCond%{} REQUEST_FILENAME!-d
重写规则^(。*)$ ./index.php/$1 [L,QSA]
 

但同样的结果。

解决方案
  1. 要检查是否mod_rewrite的模块使能,在你的WAMP的服务器的根文件夹中创建一个新的PHP文件。输入以下

    的phpinfo();

  2. 访问您创建从浏览器中的文件。

  3. <大骨节病>控制 <大骨节病> F 打开搜索。搜索mod_rewrite的。如果启用你把它看成加载模块

  4. 如果没有,开的httpd.conf(Apache的配置文件),并查找以下行。

    #LoadModule rewrite_module模块/ mod_rewrite.so

  5. 删除井号('#')符号的开始和保存该文件。

  6. 重新启动Apache服务器。

  7. 访问浏览器相同的php文件。

  8. 搜索mod_rewrite的'了。您应该现在能够找到它。

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 tried to access the URL, it returns 404 - not found page.

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.

But Hosting support is still insisting me that, their mod_rewrite is on, so I would like to know how can i check whether mod_rewrite is enable.

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

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

FYI: my .htaccess code is

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>

I tried like this also

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]

But same result.

解决方案

  1. To check if mod_rewrite module is enabled, create a new php file in your root folder of your WAMP server. Enter the following

    phpinfo();

  2. Access your created file from your browser.

  3. CtrlF to open a search. Search for 'mod_rewrite'. If it is enabled you see it as 'Loaded Modules'

  4. If not, open httpd.conf (Apache Config file) and look for the following line.

    #LoadModule rewrite_module modules/mod_rewrite.so

  5. Remove the pound ('#') sign at the start and save the this file.

  6. Restart your apache server.

  7. Access the same php file in your browser.

  8. Search for 'mod_rewrite' again. You should be able to find it now.

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

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