I am stuck with a simple regex problem.
What I want to do is to check a URL to see if it contains the word ajax and if it does then match on the URL.
For instance
given URL localhost/ajax/image/get
should match and return localhost/ajax/image/get
However localhost/image/get
should not match.
I’ve basic knowledge of regex but havn’t been able to get anything working for it.
Any suggestions? I’m sure this is quite a simple case.
I am using this for a mod rewrite Rule
The mod rewrite rule is
RewriteRule ^.?\bajax\b.$ ajax.php?url=$1 [PT,L]
URL requested http://localhost:93/public/ajax/image/
It redirects to the ajax.php file but the url values are not preserved.
I have another rule which is a general one as follows
RewriteRule ^(.*)$ index.php?url=$1 [PT,L]
URL requested http://localhost:93/public/imgage/get/
When this redirects to index.php it has /public/image/get/ in the url GET value
I solved the issue, the regex i was looking for is
^(.ajax.)$
I had been trying ^(ajax)$ but this doesn’t make sense.
Thanks for help