.htaccess - Add subdirectory to url in htaccess -


i'm trying add subdirectory url. example, /news must go /blog/news including articles

i came this:

rewritecond %{request_uri} !^/news/.*$ rewriterule ^(.*)$ /blog/news/$1 [r,l] 

see below fix!

i fixed following rule:

rewriterule ^news/(.*)$ /blog/news/$1 [r=301,nc,l] 

make sure clear cache when testing , set r=302 make temporary redirect. set r=301 once know working.


Comments

Popular posts from this blog

python - Best design pattern for collection of objects -

go - serving up pdfs using golang -

python - django admin: changing the way a field (w/ relationship to another model) is submitted on a form so that it can be submitted multiple times -