Re: Issue on Redirection in Apache

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 09/04/2014 04:25 AM, ayaskanta.praharaj@xxxxxxxxx wrote:

Hi,

My apache is successfully configured with invoking http://192.168.17.165:7777/cs website

 

My redirection case :

1) Whenever the URL:  http://192.168.17.165:7777/cs/ is invoked (After '/cs/' there would be nothing) it would be changed to http://192.168.17.165:7777/cs/idcplg?IdcService=GET_DOC_PAGE&Action="">

 

i.e. http://192.168.17.165:7777/cs changes to http://192.168.17.165:7777/cs/idcplg?IdcService=GET_DOC_PAGE&Action="">

 

 

2) But whetever the same URL is invoked with something after '/cs/' it would remain same.

i.e. http://192.168.17.165:7777/cs/index.html changes to http://192.168.17.165:7777/cs/index.html 

 

For this i have done the follwoing configuration in httpd.conf but it does not work.Please help.

{

RewriteEngine On
 
 
}
 

So, there's a couple of problems with this.

1) The first argument to RewriteRule is a regular _expression_ - so, a substring match, not a complete string equality.
2) The first argument to RewriteRule matches the URI starting after the hostname

So you want something more like:

RewriteRule ^/cs/?$
http://192.168.17.165:7777/cs/idcplg?IdcService=GET_DOC_PAGE&Action=""> [R,L]

That should do it.

^/cs/?$ means "starts with /cs, with optionally a slash after that, and then ends ($ indicates the end of a string match)

--Rich



-- 
Rich Bowen - rbowen@xxxxxxxxxxx - @rbowen
http://apachecon.com/ - @apachecon 

[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux