[Resolved] .htaccess redirect 301 issue

Status
Not open for further replies.

bh-tech

Well-Known Member
#1
Hi,

I've found a bit of a strange issue happening with certain redirect 301 lines in our .htaccess.

Example:
Code:
redirect 301 /oldurl.php http://www.domain.com.au/newurl/
When I follow the redirect path, I'm seeing this:
Code:
http://www.domain.com.au/oldurl.php
 - 301 Redirect -
http://www.domain.com.au/oldurl.php/
 - 301 Redirect -
http://www.domain.com.au/newurl/
Somehow an extra redirect is being added that adds a trailing slash to the original url, and then continues on to the final destination.

So couple of points:
  • I have seen nothing in my .htaccess that would trigger this behaviour
  • It only adds the extra slash and redirect if the final destination URL ends with a slash
I'm at a loss as to what is going on - I certainly don't think it's normal.

Any suggestions?

Thanks,
Taylor
 
Last edited by a moderator:

NiteWave

Administrator
#2
I did local test with
Code:
redirect 301 /oldurl.php /newurl/
in .htaccess. and confirmed the issue you reported.
also tested
Code:
redirect 301 /oldurl2 /newurl/
same result -- so not specific for .php files.

while under apache, one redirect only:
/oldurl.php ----> /newurl

the workaround is
Code:
redirect 301 /oldurl.php/ /newurl/
this results one redirect. and same as apache in this case.
 
Last edited by a moderator:

bh-tech

Well-Known Member
#3
Is this going to be fixed?

If I use your workaround, won't the redirect no longer work if the URL is
Code:
http://www.domain.com.au/oldurl.php
because it doesn't include a slash? Therefore the redirect rule wouldn't apply to it?
 
Last edited by a moderator:

NiteWave

Administrator
#4
>Therefore the redirect rule wouldn't apply to it?
unfortunately, not apply, after test.

however, RedirectMatch works well by my test:
>
Code:
redirect 301 /oldurl.php http://www.domain.com.au/newurl/
==>
Code:
RedirectMatch 301 /oldurl.php/? http://www.domain.com.au/newurl/
>Is this going to be fixed?
I can't answer this question at the time being. But I think our dev will estimate it
 
Last edited by a moderator:

bh-tech

Well-Known Member
#5
Hi NiteWave,

Thanks for your replies and suggestions.

Hopefully the developer can give an estimate on when this will be fixed - I don't really want to have to go through and change all my redirect's to redirectmatch's
 

mistwang

LiteSpeed Staff
#7
Please try 4.2.21 release with command
Code:
/usr/local/lsws/admin/misc/lsup.sh -f -v 4.2.21
 
Last edited by a moderator:
Status
Not open for further replies.
Top