Forum Moderators: phranque

Message Too Old, No Replies

Redirecting Dynamic to Dynamic URL

         

oswald_yang

1:41 pm on Aug 2, 2010 (gmt 0)

10+ Year Member



Hey all,

I'm having trouble getting a rewrite to work. I need:

http://www.example.com/pls/cms/tsp_jobfinder.preview_job?j_category=available&j_id=14788


to redirect to:

http://www.example.com/pls/cms/tsp_jobfinder.job_requesting?j_request=available&job_search_index=Y&p_sid=7


So after a bit of reading up I tried:

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{QUERY_STRING} ^j_category=available&j_id=14788$
RewriteRule ^pls/cms/tsp_jobfinder\.preview_job$ http://www.example.com/pls/cms/tsp_jobfinder.job_requesting?j_request=available&job_search_index=Y&p_sid=7 [R=301,L]


but to no avail. Here are the rewrite (level 9) logs:

(2) init rewrite engine with requested uri /pls/cms/tsp_jobfinder.preview_job
(3) applying pattern '^pls/cms/tsp_jobfinder\.preview_job$' to uri '/pls/cms/tsp_jobfinder.preview_job'

(1) pass through /pls/cms/tsp_jobfinder.preview_job
(2) init rewrite engine with requested uri /pics/tsp_logo.gif
(3) applying pattern '^pls/cms/tsp_jobfinder\.preview_job$' to uri '/pics/tsp_logo.gif'

(1) pass through /pics/tsp_logo.gif


Note there's is a server wide default:

ProxyPass /pls/ http://localhost:7777/pls/
ProxyPassReverse /pls/ http://localhost:7777/pls/


So the majority of my 'working' rewrites look something like this:

RewriteRule ^/contact$ http://localhost:7777/pls/cms/page?s=3270,0,0,0,176,0, [P,L]


I've also tried:

RewriteCond %{QUERY_STRING} ^j_category=available&j_id=14788$
RewriteRule ^pls/cms/tsp_jobfinder\.preview_job$ http://localhost:7777/pls/cms/tsp_jobfinder.job_requesting?j_request=available&job_search_index=Y&p_sid=7 [P,R=301,L]


without any luck and have NO idea what to try next. Any advice would be much appreciated.

Thanks!

jdMorgan

2:11 pm on Aug 2, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It appears that your code is located in a server config file such as httpd.conf, and is not enclosed in a <Directory> container.

If this is the case, then add a leading slash to your RewriteRule pattern, so that it will match the localized (or actually, as in this case, the non-localized) requested URL-path.
 RewriteRule ^/pls/cms/tsp ... 


Jim

oswald_yang

2:35 pm on Aug 2, 2010 (gmt 0)

10+ Year Member



You are correct, the rules are in the vhost file. Can't believe I missed the leading slash :)

Many thanks Jim!