Redirect problem

by 4 replies
5
Hello,

I have a problem that is driving me crazy

I have redirected a folder in one domain to a html file in some other domain using .htaccess like this:

www,domain,com/folder


to

www, newdomain, com/file.html

the redirect is working fine but it ads a / at the end of the html file

so after the redirection it looks like this:

www,newdomain,com/file.hml/




the problem is that it says that page can't be viewed and the problem is the / at the end of it


when i remove the / at the end then it works


what can i do to make my pages work with / and without / equally?

the code i've used for the redirect is:

RewriteCond %{HTTP_HOST} ^www,domain.com$

RewriteRule ^book\/?$ "http\:\/\/www\.newdomain\.com\/how\-to\-bla\.html" [R=301,L]


have googled this but didn't find anything...and i don't even know why this redirect code leaves a / at the end


Thanks a lot for the help

Best,
B
#programming #problem #redirect
  • Well due to the infinite wisdom of the mods here I can't post URLs yet until my post count is higher so you'll have to try and decipher my code.

    Change "xxx" to:
    double u double u double u dot domain dot com

    Change "yyy" to:
    haych tee tee pee://double u double u double u dot newdomain dot com/how-to-bla.html [R=301,L]

    I feel like an idiot...

    Code:
    RewriteCond %{HTTP_HOST} ^xxx$
    RewriteRule ^book/$ yyy [R=301,L]
  • May be put a question mark also after slash
    RewriteRule ^book/?$ yyy [R=301,L]
  • You should try to get in touch with an SEO professionals. They know the entire process. They can easily find and fix the problem.
  • Have you tried using the alternate redirect method?

    Code:
    Redirect 301 folder/ http://www.newdomain.com/file.html

Next Topics on Trending Feed