检查.htaccess中的模块状态

One of my favorite Apache modules is mod_rewrite. mod_rewrite allows me to manipulate page URLs so that I can search engine friendly URLs. Not every Apache server has the mod_rewrite module installed so you will want to add a conditional statement within your .htaccess file to make sure it's there.

我最喜欢的Apache模块之一是mod_rewrite。 mod_rewrite允许我操纵页面URL,以便可以搜索引擎友好的URL。 并非每个Apache服务器都安装了mod_rewrite模块,因此您将需要在.htaccess文件中添加条件语句以确保其存在。

.htaccess (The .htaccess)


#Wordpress's .htaccess code
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>


If the "mod_rewrite.c" module is present, that means that mod_rewrite is available and will be used. If not, the mod_rewrite code will be ignored. Using this conditional statement will prevent 500 Internal Server Errors.

如果存在“ mod_rewrite.c”模块,则意味着mod_rewrite可用并将被使用。 如果不是,则mod_rewrite代码将被忽略。 使用此条件语句将防止500个内部服务器错误。

翻译自: https://davidwalsh.name/check-module-presence-htaccess

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值