tags:

views:

16

answers:

1

I have rewrite URL like following

RewriteCond %{HTTP_HOST} ^subdomain\.mydomain\.example$
RewriteRule (.*) /subdomain/$1 [L]

RewriteRule ^a/(.*)/(.*)$ search.php?searchtext=$1&locationtext=$2 [NC]

And I want to call my page like

http://kolkata.mydomain.example/a/phptraining/Kolkata

But when page is opening this is saying 404 not found. I’m not understanding this error.

A: 

With this rule set only the first rule is probably applied but not the second. Try the first rule without L flag and consider a possible subdomain within the request path:

RewriteCond %{HTTP_HOST} ^subdomain\.mydomain\.example$
RewriteRule .* /subdomain/$0
RewriteRule ^([^/]+/)?a/([^/]+)/([^/]+)$ $1search.php?searchtext=$2&locationtext=$3 [NC]
Gumbo
this is running well for 3 parameters how ?
Ajay_kumar