Forum Moderators: phranque

Message Too Old, No Replies

query string

Help me; I'm drowning in this apache stuff

         

texanweb

5:56 pm on Apr 9, 2006 (gmt 0)

10+ Year Member



Everything I try is giving me zero results. So, what I am I doing wrong.

I want this http://www.example.com/guestbook/screen.php?vgbxiferp=&vgbreliam=55 to http://www.example.com/guestbook/screen.php

Here is the code I have so far:
Options +FollowSymLinks
RewriteEngine on

RewriteCond %{QUERY_STRING} vgbxiferp=&vgbreliam
RewriteRule ^screen\.php$ http://www.example.com/guestbook/screen.php [R=301,L]

jdMorgan

10:06 pm on Apr 9, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



texanweb,

Welcome to WebmasterWorld!

Let's back up a minute. What do you expect this RewriteRule to do?

From your code, you expect that if you type the URL http://www.example.com/guestbook/screen.php?vgbxiferp=&vgbreliam
into your browser, you want it to execute the file http://www.example.com/guestbook/screen.php.

Is that correct?

Jim

texanweb

10:34 pm on Apr 9, 2006 (gmt 0)

10+ Year Member



Yea why, am I doing it totally wrong?

jdMorgan

1:28 am on Apr 10, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Your code is located in /guestbook/.htaccess?

Jim

texanweb

2:12 am on Apr 10, 2006 (gmt 0)

10+ Year Member



yes

jdMorgan

2:32 am on Apr 10, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I don't see a darn thing wrong with it, then.

Do you have other working rewrites on this server?
Are you sure mod_rewrite is installed and "allowed" by the server admins?
Have you tried moving the code to the Web root ("homepage") directory, after adjusting the RewriteRule pattern?

Jim

texanweb

4:00 am on Apr 10, 2006 (gmt 0)

10+ Year Member



1. The only thing I got is example.com to a www.example.com. I have this in my main root.
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST}!^www\.example\.com [NC]
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

2. My host told me that by putting the RewriteEngine on would turn it on. I have a open ticket with them right now about it?

3. How do I adjusting the RewriteRule pattern from one directory to the main directory?

texanweb

4:01 pm on Apr 10, 2006 (gmt 0)

10+ Year Member



My hosting company wrote back and said and I quote "Unfortunately we are not trained in mod_rewrite and cannot assist you with this. I personally have not used it too much so I cannot provide you with any advice."

So now what?

jdMorgan

4:41 pm on Apr 10, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



For use in the directory above /guestbook, you'd change it like this:

RewriteCond %{QUERY_STRING} vgbxiferp=&vgbreliam
RewriteRule ^[b]guestbook/[/b]screen\.php$ http://www.example.com/guestbook/screen.ph[b]p?[/b] [R=301,L]

The trailing "?" on the substitution URL clears the query string -- and actually, that may be the root problem, because it was missing.

Jim

texanweb

6:44 pm on Apr 10, 2006 (gmt 0)

10+ Year Member



Ok I got 2 problems:
- The redirect didn't work in my main root for some reason, so I left it in my guestbook directory. It is now redirecting in Firefox but not in IE.

- When I click on the link, it is brings up a blank page both in Firefox and IE.

I don't know what else to do. Everything should be working. I have my .htaccess CH mode on 744. Is that the right permission?

jdMorgan

12:09 am on Apr 11, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I run .htaccess permissions at 644, and 444 ought to work on most servers.

1) Did you flush your browser cache(s) (Temporary Internet Files) before testing?
2) You are now calling screen.php with a blank query string. What do you expect screen.php to do in this case?
3) What do you get if you directly enter http://www.example.com/guestbook/screen.php in the browser address bar - a blank page, or something else?

Jim

texanweb

12:44 am on Apr 11, 2006 (gmt 0)

10+ Year Member



I change my permission to 444.

- yes I did, and it still don't do it
- it suppose to email that user who wrote that message
- blank screen

Here is the web address: <snip>. If you go to someone's email address on this guestbook, it brings up a blank screen. All I want is to get rid of all the junk pass screen.php.

[edited by: jdMorgan at 2:25 am (utc) on April 11, 2006]
[edit reason] No URLS, please. See Terms of Service. [/edit]

jdMorgan

2:48 am on Apr 11, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm afraid you're misunderstanding something about mod_rewrite, or the script, or both.

The function of mod_rewrite is not to make pretty URLs. And your script apparently requires the information that we finally succeeded in removing, with the result that it broke the script.

If the query string parameters are required by the script, then you cannot remove them and expect it to work.

I'm sorry, but I don't know where to go from here. If it were my site, I'd leave it alone.

For more information about mod_rewrite applications, see the tutorials in the Apache forum section of the WebmasterWorld library [webmasterworld.com].

Jim

texanweb

3:02 am on Apr 11, 2006 (gmt 0)

10+ Year Member



Ok, thanks any way. Sorry about putting my real domain in. Forgot!