Apache 带有/~用户名的绝对链接和临时URL

Apache 带有/~用户名的绝对链接和临时URL,apache,mod-rewrite,Apache,Mod Rewrite,我正在将一个大型站点移动到一个专用服务器。目前,我必须像http://[dottedquad]/~username/index.php那样访问它 这让我所有的绝对链接都中断了 是否有一个mod_重写方法来说明如果找不到文件,请检查前缀为/~ username的相同路径 还是一种不必更新文件就可以设置基本href的全局方法 如果需要检查文件是否存在 #whatever your original rewrite rule is RewriteRule ^(.+) regular/place/$1

我正在将一个大型站点移动到一个专用服务器。目前,我必须像http://[dottedquad]/~username/index.php那样访问它

这让我所有的绝对链接都中断了

是否有一个mod_重写方法来说明如果找不到文件,请检查前缀为/~ username的相同路径


还是一种不必更新文件就可以设置基本href的全局方法

如果需要检查文件是否存在

#whatever your original rewrite rule is
RewriteRule ^(.+) regular/place/$1 [NC,QSA]

#if file does not exist
RewriteCond %{REQUEST_FILENAME} !-f

#use the other path
RewriteRule ^(.+) ~username/$1 [NC,QSA,L]
如果ReWriteCond找到文件,第二条重写规则将永远不会触发。如果有,第二条重写规则将启动


我的正则表达式可能已关闭,但希望你能理解我所说的。键是“!-f”,基本上用来检查文件。

如果需要检查文件是否存在

#whatever your original rewrite rule is
RewriteRule ^(.+) regular/place/$1 [NC,QSA]

#if file does not exist
RewriteCond %{REQUEST_FILENAME} !-f

#use the other path
RewriteRule ^(.+) ~username/$1 [NC,QSA,L]
如果ReWriteCond找到文件,第二条重写规则将永远不会触发。如果有,第二条重写规则将启动

我的正则表达式可能已关闭,但希望你能理解我所说的。键是“!-f”,它基本上是用来检查文件的。

也许这会有帮助。也许这会有帮助。