简体   繁体   English

如何使用htacess文件将特定目录mod_rewrite到根目录

[英]How to do mod_rewrite particular directory to root using htacess file

MY hosting has disabled virtual directory mapping so i need to use mod_rewrite . 我的主机已禁用虚拟目录映射,因此我需要使用mod_rewrite。 please guide me how to do . 请指导我怎么做。 I want to map http://example.com/folder/dashboard.php to http://example.com/dashboard.php 我想将http://example.com/folder/dashboard.php映射到http://example.com/dashboard.php

In the htaccess file in your document root, add: 在文档根目录的htaccess文件中,添加:

RewriteEngine On
RewriteCond $1 !^folder/
RewriteRule ^(.*)$ /folder/$1 [L]

And then make sure all your links look like http://example.com/dashboard.php 然后确保所有链接看起来像http://example.com/dashboard.php

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

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