regex - 301 Redirect All Blog Posts To New Subfolder -


i using .htaccess rewrite pretty urls blog posts:

rewriterule ^([a-za-z0-9-]+)$ /item.php?slug=$1 [l] 

this ends looking like:

example.com/my-new-awesome-blog-post

what move posts new folder called items like:

example.com/items/my-new-awesome-blog-post

i not want move blog posts subfolder, ensure proper 301 redirect there no issue seo.

thank help/advice.

you can use code in document_root/.htaccess file:

options -multiviews rewriteengine on rewritebase /  # if request not valid directory rewritecond %{request_filename} !-d # if request not valid file rewritecond %{request_filename} !-f rewritecond %{the_request} !\s/+items/ [nc] rewriterule ^ items%{request_uri} [l,ne,r=302]  rewriterule ^items/([a-za-z0-9-]+)/?$ items/item.php?slug=$1 [l,qsa] 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -