Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.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 使用htaccess删除URL中的所有子目录_Apache_.htaccess_Mod Rewrite_Redirect_Expressionengine - Fatal编程技术网

Apache 使用htaccess删除URL中的所有子目录

Apache 使用htaccess删除URL中的所有子目录,apache,.htaccess,mod-rewrite,redirect,expressionengine,Apache,.htaccess,Mod Rewrite,Redirect,Expressionengine,我运行一个ExpressionEngine站点,该站点将加载一个文章页面,而不管在地址栏中键入的子目录名是什么 例如,所有这些地址: http://hellothere.example.com/health/mental/depression http://cats.example.com/health/mental/depression http://dogs.example.com/health/mental/depression http://www.batman.example.com/

我运行一个ExpressionEngine站点,该站点将加载一个文章页面,而不管在地址栏中键入的子目录名是什么

例如,所有这些地址:

http://hellothere.example.com/health/mental/depression
http://cats.example.com/health/mental/depression
http://dogs.example.com/health/mental/depression
http://www.batman.example.com/health/mental/depression
http://www.1.2.3.4.5.6.example.com/health/mental/depression
将加载
example.com/health/mental/depression

显然,这对于SEO来说并不理想,因为我有一个潜在的无限数量的重复URL

我正试图找出如何使用htaccess在example.com之前剥离任何内容,并将其替换为www.example.com


任何帮助都将不胜感激

您不能使用htaccess执行此操作。实现这一点的方法是设置通配符dns记录,以便所有请求(*.example.com)都指向同一服务器