开发者

Apache ignore htaccess

开发者 https://www.devze.com 2023-03-24 02:25 出处:网络
I have a website that uses mod_rewrite for pretty urls. I have two main urls: example.com/id example.com/generate/id

I have a website that uses mod_rewrite for pretty urls. I have two main urls:

example.com/id
example.com/generate/id

And this htaccess file:

Options +FollowSymLinks
RewriteEn开发者_C百科gine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^generate/([a-z0-9_-]+)$ generate.php?id=$1 [L,NC]
RewriteRule ^([a-z0-9_-]+)$ contact.php?id=$1 [L,NC]

The first url is working correctly, but the second not. Apache shows a 404 error, I think that it's because it's looking for the folder "generate", that doesn't exist, and it can't find the htaccess in the document root.

Thank you


Have you try

RewriteRule ^generate\/([a-z0-9_-]+)$ generate.php?id=$1 [L,NC]
0

精彩评论

暂无评论...
验证码 换一张
取 消