简体   繁体   English

Htaccess重写链接在.htaccess文件中不起作用

[英]Htaccess rewrite links doesn't work in .htaccess file

I have a website and I tried to rewrite links using htaccess file but the rewrited link does not work. 我有一个网站,我尝试使用htaccess文件重写链接,但重写的链接不起作用。 The original link is like this : 原始链接是这样的:

http://my-website.com/open?cours=3em-tricks http://my-website.com/open?cours=3em-tricks

I want to rewrite it to this form: 我想将它重写为这种形式:

http://my-website.com/tuto/cours/3em-tricks/ http://my-website.com/tuto/cours/3em-tricks/

In the .htaccess file I write this code: .htaccess文件中我写了这段代码:

RewriteEngine On
RewriteBase /
RewriteRule ^tuto/cours/(.*)$ open?cours=$1 [N]

But I always get the 404 page in rewrited link. 但我总是在重新链接的链接中获得404页面。 Note the the htaccess module is activate on server. 请注意,htaccess模块​​在服务器上激活。

Maybe it's the trailing slash and the N . 也许这是尾随斜线和N

RewriteEngine On
RewriteBase /
RewriteRule ^tuto/cours/(.*)/?$ open?cours=$1 [L]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM