Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/kubernetes/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 子域和文件夹的重写规则_Apache_Mod Rewrite_Subdomain - Fatal编程技术网

Apache 子域和文件夹的重写规则

Apache 子域和文件夹的重写规则,apache,mod-rewrite,subdomain,Apache,Mod Rewrite,Subdomain,我需要为Apache编写重写规则,以便与子域一起使用。这些规则应基于: subdomain.domain.com => /home/domain/docs/some_folder/file.php?subdomain=subdomain subdomain.domain.com/edit => /home/domain/docs/some_other_folder/file.php subdomain.domain.com/dashboard/display/id => /ho

我需要为Apache编写重写规则,以便与子域一起使用。这些规则应基于:

subdomain.domain.com => /home/domain/docs/some_folder/file.php?subdomain=subdomain
subdomain.domain.com/edit => /home/domain/docs/some_other_folder/file.php
subdomain.domain.com/dashboard/display/id => /home/domain/docs/some_other_folder2/file.php?param1=display&param2=id
我还在网站上使用AJAX调用,这并不容易,因为我从搜索互联网中了解到了这一点。因此,这方面的一些提示也确实会有帮助

我真的很感谢你的帮助!
提前谢谢。

我要试试这个

RewriteEngine on
RewriteBase /

RewriteCond %{HTTP_HOST} !^subdomain.domain.com$
RewriteRule .* - [L]

RewriteCond %{HTTP_HOST} (.*)
RewriteRule ^$  /home/docs/some_folder/file.php?subdomain=%1 [L,QSA]
RewriteRule ^edit$  /home/docs/some_other_folder/file.php [L]
RewriteRule ^dashboard/(\w+)/(\w+) /home/docs/some_other_folder2/file.php?param1=$1&param2=$2 [QSA,L]