Sunday, 15 September 2013

redirect - .htaccess 301 re-directing .html pages to sitemap.html -



redirect - .htaccess 301 re-directing .html pages to sitemap.html -

i've tried 301 redirecting .html pages sitemap.html in 2 ways , neither 1 works.

i've checked code on , on again. i've used .htaccess checkers/validators , show no errors. the same code works folder-to-folder re-directs--this happens re-directs .html files sitemap.html.

the problem:

the pages should redirected www.example.com/sitemap.html

instead they're redirected www.example.com/sitemap.htmlpage.html

in other words, .htaccess somehow puts file name after sitemap.html.

i've used these 2 methods:

1:

rewriterule ^directory/(.*)$ /sitemap.html$1 [r=301,nc,l]

in first one, files within directory should re-directed sitemap.html. note index page of category re-directs fine .html ending pages within don't.

2:

redirect 301 /directory/page.html http://www.example.com/sitemap.html

i've tried redirecting each page individually same results.

any thought what's wrong here?

you should not utilize captured redirecting /sitemap.xml. utilize rule in root .htaccess:

rewriteengine on rewriterule ^directory/ /sitemap.html [r=301,nc,l]

.htaccess redirect

No comments:

Post a Comment