简体   繁体   English

.htaccess从根URL重定向

[英].htaccess redirecting from root url

I have a folder contains php files as following: 我有一个包含php文件的文件夹,如下所示:

view/
-a.php
-b.php
-c.php

I'm trying to redirect root url to view folder like domain.com/a.php to doman.com/view/a.php . 我正在尝试将根url重定向到view文件夹,例如domain.com/a.phpdoman.com/view/a.php

.htacess .htacess

RewriteEngine On
RewriteRule ^(.*?).php view/$1.php
   RewriteBase /
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule ^(.*).php$       view/$1.php [L,QSA]

You can also do this editing your DocumentRoot at apache httpd.conf: 您也可以在apache httpd.conf中编辑DocumentRoot:

DocumentRoot "current_path/view/" DocumentRoot“当前路径/视图/”

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

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