Forum Moderators: phranque
RewriteCond %{HTTP_HOST} example.com/folder1/$ [NC]
RewriteCond %{HTTP_HOST} !subfolder1 [OR]
RewriteCond %{HTTP_HOST} !subfolder2 [OR]
RewriteCond %{REQUEST_URI} !(subfolder1|subfolder2) RewriteRule ^folder1/([^/]+/.*) http://www.example.com/folder2/$1 [R=301,L] Yes, it does contain pages that are not product pages.
example.com/folder1/product1.html is moving to example.com/product1.html
...
They don't have a file extension at the end e.g. .html, whereas the products do.
RewriteRule ^folder1/([^./]+\.html) http://www.example.com/$1 [R=301,L]
RewriteRule ^folder1/([^/]+/.*) http://www.example.com/folder2/$1 [R=301,L] ^folder1/([^./]+)\.html RewriteCond %{REQUEST_URI} !index\.html Unfortunately, category pages are set to use the .html extension (should not have been but are). Therefore, we have category pages following this format: example.com/folder1/category-name.html and these will be moving to example.com/folder2/category-name.html. These will fall under the product rule and be redirected to example.com/category-name.html.
The non-product pages are not staying in /folder1. They will also be moving to the root. Sorry if I didn't make this clear.
^folder1/[^./]+\.html ^folder1/[^/]+$ RewriteRule ^folder1/(file|otherfile|thirdfile|fourthfile)\.html http://www.example.com/folder2/$1.html [R=301,L] RewriteRule ^folder1/([^/]+)$ http://www.example.com/$1 [R=301,L] RewriteRule ^folder1/(.*) http://www.example.com/folder2/$1 [R=301,L] 4 rules...
RewriteRule ^folder1(/(index\.html)?)?$ - [G] /folder1/subdirectory/ /folder1/subdirectory/index.html /folder1/subdirectory /folder1/subdirectory/ /folder1/subdirectory/ /folder1/subdirectory /folder1/subdirectory/index.html /folder1/subdirectory RewriteCond %{REQUEST_URI} !-d RewriteCond %{REQUEST_URI} !/folder1/(subdir|othersub|thirdsub)$ RewriteRule ^folder1/(subdir|othersub|thirdsub)(/index\.html)?$ http://www.example.com/folder2/$1/ [R=301,L] As explained previously, our category pages are set to have the file extension .html added. Ideally we should change this however to be subdirectory/
/folder1/category (presumably rewritten to /folder1/category.xtn) /folder2/category/index.html (with URL simply /folder2/category/) RewriteRule ^folder1/(file|otherfile|thirdfile|fourthfile)$ http://www.example.com/folder2/$1.html [R=301,L] RewriteRule ^folder1/([^./]+)(/index\.html)?$ http://www.example.com/folder2/$1/ [R=301,L] RewriteRule ^folder1/([^/]+)$ http://www.example.com/$1 [R=301,L] RewriteRule ^folder1/(.*) http://www.example.com/folder2/$1 [R=301,L] if I understand rightly that you mean characters " ' "
RewriteRule ^shop2$ - [G]
and is there a way to combine multiple subdirectories together in one rule as you have in rule 1 above:
RewriteRule ^folder1/(removed1|removed2|removed3)$ - [G]
RewriteRule ^shop3/category1$ http://www.example.com/category1/$1.html [R=301,L]
RewriteRule ^shop3/category2$ http://www.example.com/category2/$1.html [R=301,L]
RewriteRule ^shop3/(category1|category2)$ http://www.example.com/$1/ [R=301,L] RewriteRule ^shop3/(category1|category2)$ http://www.example.com/$1.html [R=301,L] RewriteRule ^foldername/(subdir1|subdir2|subdir3)/(.+) http://www.example.com/$1/$2 [R=301,L]
Should it be RewriteRule ^shop2(.*)$ - [G]
RewriteRule ^shop2 - [G] ^shop2(/(index.html)?)?$ ErrorDocument 410 /shop2/shop2gone.html The generic pattern can replace which redirects?
RewriteRule ^folder/subdir1/(.*) http://www.example.com/subdir1/$1 [R=301,L]
RewriteRule ^folder/subdir2/(.*) http://www.example.com/subdir2/$1 [R=301,L]
RewriteRule ^folder/subdir3/(.*) http://www.example.com/subdir3/$1 [R=301,L] RewriteRule ^folder/(subdir1|subdir2|subdir3)/(.*) http://www.example.com/$1/$2 [R=301,L] If the entire content of /shop2/ is moving
Truthfully I didn't fine-tooth-comb the latest version.
Do the following look correctly formed?
RewriteRule ^folder/(subdir1|subdir2|subdir2/subsubdir)$ - [G]