duan02143 2016-05-31 02:11
浏览 26

.htaccess阻止WP管理员用户访问WP的管理功能

I've been looking for a way to hide the file extensions from URLs and I came across this code:

<IfModule mod_rewrite.c>
## Go Daddy servers need the Options -MultiViews code below
Options -MultiViews

RewriteEngine On
RewriteBase /

# To externally redirect /dir/foo.php to /dir/foo
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R,L,NE]

## To internally redirect /dir/foo to /dir/foo.php
RewriteCond %{REQUEST_FILENAME}.php -f [NC]
RewriteRule ^ %{REQUEST_URI}.php [L]
</IfModule>

It works beautifully until I found out that for some reason this was blocking WP admin features in my WP admin account, meaning I couldn't activate/deactivate plugins, add/edit/delete users and so on. So I was forced to remove the .htaccess file and now I have the .php extensions back in my URLs.

Is there a way of hiding the extensions from my URLs without losing my WP admin capabilities? Cheers.

  • 写回答

1条回答 默认 最新

  • dtvjl64442 2016-05-31 04:01
    关注

    Is there a specific reason you want to hide the .php extension of admin urls in the first place? You can prettify the public-facing URLs in WP using standard methods.

    评论

报告相同问题?

悬赏问题

  • ¥15 使用C#,asp.net读取Excel文件并保存到Oracle数据库
  • ¥15 C# datagridview 单元格显示进度及值
  • ¥15 thinkphp6配合social login单点登录问题
  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配