问题
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.
回答1:
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]
来源:https://stackoverflow.com/questions/3223063/htaccess-problem-404-not-found