apache - .htaccess - redirect request to directory and any of it's files and subdirectories to single URL -
redirect /product/
, of it's files or subdirectories http://example.com
without appending file, subdirectory or params it.
example:
http://example.com/something/product
-> http://example.com
http://example.com/something/product/some-dir/
-> http://example.com
http://example.com/something/product/?foo=bar
-> http://example.com
http://example.com/something/product/some-dir/some-file.html
-> http://example.com
i've tried quite few rewriterule
solutions i've found on stackoverflow (most of can found here) append subdirectories, files or params. example:
http://example.com/something/product/some-dir/
redirects http://example.com/some-dir
where i'd (and else under , including products
) redirect http://example.com
here's example of 1 of .htaccess files tired failed:
rewriteengine on rewriterule ^products\/.+ http://example.com [nc,l]
update
i've deleted .htaccess file on local machine i'm still getting redirects. have been changes made .htaccess file while testing weren't getting noticed? maybe 1 of solutions had have worked! 😱
Comments
Post a Comment