0

hello
i need little help with url rewriting

i have page :: www.mysite.com/search.php?q=something
desire url structure:: www.mysite.com/q/something

.htaccess code :: RewriteRule q/(.*) search.php?q=$1

the above htaccess code work fine but i have little more htaccess code for my site

.htaccess code :: RewriteRule www.(.*) web.php?url=$1
desire url structure:: www.mysite.com/www.daniweb.com

so now problem is when query is made like www.mysite.com/q/http://www.daniweb.com then parameter http://www.daniweb.com is sent to both htaccess code due to which two php pages mixup in othe another .
so please help so that /q/something is only sent to search.php

1
Contributor
1
Reply
2
Views
5 Years
Discussion Span
Last Post by nova37
1

i solved the [rblem finally and i will post is solution maybe it will help someone

problem ::
i have two rewrite rules

RewriteRule q/(.*) search.php?q=$1
RewriteRule www.(.*) web.php?url=$1

now if someone come to site and have url like : www.site.com/q/www.daniweb.com

i can see /q/www.daniweb.com and i want that it pass to search.php but in this case it will pass to both rules and as result two php pages (search.php and web.php) will open simultanenously which is not good becuase two pages open at once result one dirty page full of both pages results

so to avoid that problem we should skip one rule becuase we are only interested in search.php as parameters as passed as /q/www.daniweb.com

solution::

RewriteRule q/(.*) search.php?q=$1 [S=1]
RewriteRule www.(.*) web.php?url=$1

s=1 // # of rules u want to skip i want to skil web.php so i set s=1
that all :)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.