Hi,
I am trying to remove part of a URL using mod_rewrite, but what I have isn’t working.
I have the following URL:
https://www.website.co.uk/phase-2/job/blog-post-title/
(the /phase-2/ is temporary as this is a development stage so it will be switched to not using that part)
I’m trying to remove the /job/ part of the URL.
This is what I have:
RewriteEngine ON
RewriteRule ^job/(.*)$ $1 [L,QSA]
Can anyone tell me what I have wrong?
Thanks
rpkamp
2
As long as phase-2
is in the URL that RewriteRule
is never going to match, you’d need to include it:
RewriteEngine On
RewriteRule ^phase-2/job/(.*) /phase-2/$1 [L,QSA]
Did you want to redirect the browser by the way, or leave the URL in the browser as is?
Hi,
Thanks for the reply. I think ideally it would redirect them.
rpkamp
4
Ok, in that case you should replace [L,QSA]
with [L,QSA,R=301]
1 Like
Many thanks for your help 
system
Closed
6
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.