简体   繁体   English

.htaccess将呼叫更改为localhost / <file/path> 到localhost / something / <file/path>

[英].htaccess changing calls to localhost/<file/path> to localhost/something/<file/path>

I have looked through the q&a's and couldn't work out how to do it based from the answers 我已经浏览了问题解答,但根据答案无法解决

if I want to make 如果我想做

all requrests to localhost/[file/path] 所有要求到本地主机/ [文件/路径]

to

localhost/something/[file/path] 本地主机/某物/ [文件/路径]

what is the .htaccess 什么是.htaccess

I have tried 我努力了

RedirectMatch localhost/$ /something/ RedirectMatch本地主机/ $ / something /

RedirectMatch ^/$ /something/ RedirectMatch ^ / $ / something /

try 尝试

RedirectMatch ^(.*)$ /something/$1 [L]

the ( and ) capture the original url so you can use it later with $1 as the first capture group. ()捕获原始url,以便以后以$1作为第一个捕获组使用。

note: if you're working with query strings, make sure the flag is [L,QSA] 注意:如果要使用查询字符串,请确保标记为[L,QSA]

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

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