hounded
hounded

Reputation: 726

.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

I have tried

RedirectMatch localhost/$ /something/

RedirectMatch ^/$ /something/

Upvotes: 0

Views: 44

Answers (1)

user3276552
user3276552

Reputation: 1072

try

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

the ( and ) capture the original url so you can use it later with $1 as the first capture group.

note: if you're working with query strings, make sure the flag is [L,QSA]

Upvotes: 2

Related Questions