本文介绍了.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重写
发布评论