简体   繁体   English

使用 .htaccess 删除 URL 中的子目录文件夹并重定向到预期文件

[英]Remove subdirectory folder in URL using .htaccess and get redirected to the intended files

I have the following URL: https://www.bidhaa.net/scripts/details I managed to remove.php extension using .htaccess Now, I need to remove scripts folder in URL and get redirected to the intended files in scripts folder so that URL become https://www.bidhaa.net/details I have the following URL: https://www.bidhaa.net/scripts/details I managed to remove.php extension using .htaccess Now, I need to remove scripts folder in URL and get redirected to the intended files in scripts folder so that URL 变为https://www.bidhaa.net/details

Try To add this code on your .htaccess file尝试将此代码添加到您的 .htaccess 文件中

RewriteEngine On 
RewriteRule ^scripts/(.*)$ /$1 [L]

i found the answer from this link, maybe this will help Remove directory from URL with我从这个链接中找到了答案,也许这将有助于从 URL 中删除目录

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

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