Reputation:
.htaccess file with following code
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^tag/([A-Za-z0-9_]+)$ hashtag.php?hashtag=$1
RewriteRule ^([A-Za-z0-9_]+)$ profile.php?username=$1
and in nginx rewrite, i set like this
location / {
if (!-e $request_filename){
rewrite ^/([A-Za-z0-9_]+)$ /profile.php?username=$1;
}
if (!-e $request_filename){
rewrite ^tag/([A-Za-z0-9_]+)$ /hashtag.php?hashtag=$1;
}
}
i can visit domain.com/hashtag.php?hashtag=123, domain.com/profile.php?username=name, and also i can visit domain.com/name, but i can't visit domain.com/tag/123, it shows 404 error. Can you help me? thanks a lot.
Upvotes: 0
Views: 60
Reputation:
There's a error in my nginx rewrite configure, it should be
rewrite ^/tag/([A-Za-z0-9_]+)$ /hashtag.php?hashtag=$1;
I miss the /, close this question.
Upvotes: 1