troubleshooting Question

Mod_Rewrite Help

Avatar of derek2277
derek2277 asked on
PHPApache Web ServerWeb Servers
11 Comments1 Solution404 ViewsLast Modified:
I have a search engine and I am attempting to rewrite the queries.  Here is what I have so far in my .htaccess:

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
 
RewriteCond %{REQUEST_URI} /xanga/search.php$
RewriteCond %{QUERY_STRING} ^query=((.*)+)&search=1$
RewriteRule ^(.*)$ /xanga/keywords-%1? [R=301,L]
 
RewriteRule ^keywords-(.*)$ /xanga/search.php?query=$1&search=1&a=1 [L]

***This works fine and displays the url correctly:

ex. http://www.mysite.com/xanga/keywords-myquery*** 

I am running into a problem when I try to send the user to the next page of results.  Apache is not redirecting the url at all:

RewriteCond %{REQUEST_URI} /xanga/search.php$
RewriteCond %{QUERY_STRING} ^query=((.*)+)&search=1&start=([0-9]+)$
RewriteRule ^(.*)/(.*)$ /xanga/keywords-%1/%2? [R=301,L]

RewriteRule ^keywords-(.*)/(.*)$ /xanga/search.php?query=$1&search=1start=$2$a=1 [L]

</IfModule>

I would like to add that if I manually alter the url in the address bar it attempts to search for the entered string: ex. http://www.mysite.com/xanga/keywords-myquery/2 will search the database for "myquery/2"

Anyone know how to fix this?  Please let me know if I need to give more info.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 11 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 11 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros