.htaccess 文件重定向以相同字符串开头的页面
我正在尝试重定向两个页面,并且使用以下代码
RewriteRule projects/(.+) /Pages/Shop/SinglePortfolio.php?ID=$1 [NC,L]
RewriteRule projects$ /Pages/Shop/Portfolio.php [NC,L]
第一页将类似于 /projects/project-no-one 第二个是 /projects
此规则当前显示 Portfolio.php 页面,但不显示 SinglePortfolio.php (404) 如果我恢复规则,则显示 SinglePortfolio.php 页面,但不显示 SinglePortfolio.php (404)
尝试
- 在项目 $ 处不使用 $
- 其他正则表达式
- 将项目/(.+) 更改为项目/(.+),但前缀是相同,这似乎会引起问题。
I am trying to redirect two pages and i am using thw following code
RewriteRule projects/(.+) /Pages/Shop/SinglePortfolio.php?ID=$1 [NC,L]
RewriteRule projects$ /Pages/Shop/Portfolio.php [NC,L]
The first page will be like /projects/project-no-one
The second will be the /projects
This rule is currenty shows the Portfolio.php page, but not the SinglePortfolio.php (404)
If i revert the rules shows the SinglePortfolio.php page, but not the SinglePortfolio.php (404)
Tried
- Without the $ at projects$
- Other regular expressions
- changing the projects/(.+) to project/(.+) but the prefix is the same and that seems to cause a problem.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论