Member Avatar

i need little help with url rewriting

i have page ::
desire url structure::

.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::

so now problem is when query is made like then parameter 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

Member Avatar

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 :

i can see /q/ 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/


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 :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.