Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache 正在从url中删除子文件夹_Apache_.htaccess_Mod Rewrite_Url Rewriting_Url Redirection - Fatal编程技术网

Apache 正在从url中删除子文件夹

Apache 正在从url中删除子文件夹,apache,.htaccess,mod-rewrite,url-rewriting,url-redirection,Apache,.htaccess,Mod Rewrite,Url Rewriting,Url Redirection,我已成功设置.htaccess文件,以便使用将网站重定向到子文件夹 RewriteEngine on RewriteCond %{HTTP_HOST} ^(www.)?domain.org$ RewriteCond %{REQUEST_URI} !^/subfolder/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /subfolder/$1

我已成功设置.htaccess文件,以便使用将网站重定向到子文件夹

RewriteEngine on 

RewriteCond %{HTTP_HOST} ^(www.)?domain.org$ 

RewriteCond %{REQUEST_URI} !^/subfolder/ 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 

RewriteRule ^(.*)$ /subfolder/$1 

RewriteCond %{HTTP_HOST} ^(www.)?domain.org$ 
RewriteRule ^(/)?$ subfolder/index.php [L]
因此,当我进入我的域时,它不会显示/subfolder/index.php

但是当我访问我的网站上的一个页面时,它将是www.domain.org/subfolder/anotherpage/,我想要www.domain.org/anotherpage//

谢谢你的帮助

谢谢你

你试过这个吗:

//Rewrite to www
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain.org[nc]
RewriteRule ^(.*)$ http://www.domain.org/$1 [r=301,nc]

//301 Redirect Entire Directory
RedirectMatch 301 subfolder(.*) //$1

尝试一下以下规则:

RewriteEngine On

RewriteCond %{HTTP_HOST} ^(www\.)?domain.org$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/subfolder/ [NC]
RewriteRule ^(.*)$ /subfolder/$1 [NC,L]

RewriteCond %{HTTP_HOST} ^(www\.)?domain.org$ [NC]
RewriteRule ^/?$ /subfolder/index.php [NC,L]

您是否相应地更改了值?是的,我将其中的域更改为我的域名,子文件夹更改为文件夹的名称这与我的相同。“转到我的网站”可以使用www.domain.org,但单击导航栏中的链接会添加/subfolder/page