.htaccess基本mod重写

编程入门 行业动态 更新时间:2024-10-15 14:18:22
本文介绍了.htaccess基本mod重写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我才刚刚开始学习如何使用.htaccess文件重写网址。

I am only just starting to learn how to rewrite urls with the .htaccess file.

我将如何更改:

www.url/games/game_one.php

变为:

www.url/games/game-one/

这就是我一直在尝试

RewriteRule ^/games/game-one.php ^/games/game-one/ [NC,L]

推荐答案

如果您希望人们使用 /游戏/游戏一/ ,必须重写以请求 /game/game-one.php 。因此,与您提出的问题相反。

If you want people to use /games/game-one/ explicitly, you have to rewrite so that it requests /game/game-one.php. So the opposite way around than you have it in your question.

RewriteEngine On RewriteRule ^games/game-one/$ /games/game-one.php

如果您也想重写其他URL,那么您需要使用与先前答案类似的技术。

If you want to rewrite other URL's too, then you'd need to use a technique similar to the prior answer.

更多推荐

.htaccess基本mod重写

本文发布于:2023-11-01 13:10:56,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1549412.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:重写   htaccess   mod

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!