简体   繁体   English

Apache htaccess将条件重写到服务器上的根文件夹

[英]Apache htaccess rewrite condition to root folder on server

I need to create a rewrite condition to route to a different folder on my server. 我需要创建一个重写条件以路由到服务器上的其他文件夹。

something like this http://mydomain.com/newapp/(.*)$ 像这样的东西http://mydomain.com/newapp/(.*)$

should rewrite to /var/www/mynewapp/index.php/$1 应该重写为/var/www/mynewapp/index.php/$1

i can't for the life of me figure out how to write that conditions, no matter what i do it stays in my current app.... 无论我做什么,我都无法弄清楚该如何写这些条件。

RewriteEngine on
RewriteRule ^newapp/(.*)$ /var/www/mynewapp/index.php/$1 [L,QSA]

that's what i've tried but as i said keeps redirecting back to the original app. 这就是我尝试过的方法,但是正如我所说的,不断重定向回原始应用程序。

If the /var/www/mynewapp/index.php is not within the original DocumentRoot (which seems like the case), I would just symlink /var/www/myoldapp/newindex.php to /var/www/mynewapp/index.php and use something like 如果/var/www/mynewapp/index.php不在原始DocumentRoot中(看起来是这种情况),我只需将/var/www/myoldapp/newindex.php符号链接到/var/www/mynewapp/index.php和使用类似的东西

RewriteCond %{REQUEST_URI} ^newapp
RewriteRule ^newapp/(.*)$ newindex.php [L]

to redirect the requests. 重定向请求。

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

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