Forum Moderators: phranque

Message Too Old, No Replies

How to make this URL work?

it gives 404 on my server

         

sdani

10:40 am on Aug 6, 2004 (gmt 0)

10+ Year Member



This URL works on my server:

This URL works:
[mydomain.com...]

But the following one fails:
[mydomain.com...]

Note that the first one has "%3F" & "%3D" instead of "?" & "=" Also it has "%2520" instead of "%20".

All I do from this URL is take the keywords in the URL and prefill them in my search form's query box. I am using the second URL in my Adwords campaign, and it works, but somehow, some users and some of google's automated verification processes using the first format and I want to make that one work too ..

Thanks
SDani

jdMorgan

2:01 am on Aug 7, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



sdani,

The only thing I can think of is that the "?" should never be escaped, as it is required to separate the query string from the URL. I suspect this is why you are getting the 404 error; The server sees the entire string as a URL, instead of as a URL with a query string appended.

You could try using mod_rewrite to change the first "%3f" you find in the URL to "?", and that might help.

Jim

sdani

2:44 am on Aug 7, 2004 (gmt 0)

10+ Year Member



Thanks jdMorgan,

I will try to figure out the correct rewrite rule to accomplish this and post it here for review.

SDani

sdani

8:51 am on Aug 7, 2004 (gmt 0)

10+ Year Member



I tried following rewrite rule, and it did not work:

RewriteEngine on
Options +FollowSymlinks
RewriteBase /
RewriteRule ^(.*)index\.php\%3F(.*) $1index.php?$2 [NC,L]

Can you please point out the error here.

THANKS in advance
SDani

jdMorgan

6:18 pm on Aug 7, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You didn't say how "it didn't work," but I'd recommend trying:

Options +FollowSymlinks
RewriteEngine on
RewriteBase /
RewriteRule ^index\.php\%3F(.*) /index.php?$1 [NC,R=301,L]

This may have to be adjusted, depending on whether you place the code in .htaccess or httpd.conf, and the location of your index.php script.

Jim

sdani

6:39 pm on Aug 7, 2004 (gmt 0)

10+ Year Member



Thanks Jim

Regards
SDani