简体   繁体   English

htaccess 中的 RewriteRule 文件目录

[英]RewriteRule File Directory in htaccess

I have a php file inside folder of the website.我在网站的文件夹中有一个 php 文件。 For example, the file path is https://example.com/admin/login.php例如文件路径为https://example.com/admin/login.php

Then I want to put in htaccess with following code:然后我想用以下代码放入htaccess:

RewriteEngine on
RewriteCond %{HTTPS} off

RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteRule ^$ index.php [L]
RewriteRule ^login$ admin/login.php [L]

Unfortunately, it's not work.不幸的是,它不起作用。 I tried to search and read many tutorial but it still doesn't work too.我尝试搜索并阅读了许多教程,但它仍然无法正常工作。 Is anybody know what I have to write the htaccess?有人知道我必须写什么htaccess吗? Thanks before.之前谢谢。

Move the "login" rule up before the "index" rule that catches everything.将“登录”规则上移到捕获所有内容的“索引”规则之前。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM