如何检查的mod_rewrite是否能在服务器上?能在、器上、mod_rewrite

2023-09-02 00:19:32 作者:〃死亡辶霊

目前我使用的主机是光速服务器。托管称的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]
 
未转变者怎么在steam上安装地图和mod

但同样的结果。

解决方案

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

的phpinfo();

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

控制 F 打开搜索。搜索mod_rewrite的。如果启用你把它看成加载模块

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

#LoadModule rewrite_module模块/ mod_rewrite.so

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

重新启动Apache服务器。

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

搜索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.

解决方案

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();

Access your created file from your browser.

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

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

#LoadModule rewrite_module modules/mod_rewrite.so

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

Restart your apache server.

Access the same php file in your browser.

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