使用.htaccess RewriteRule重写基于数字的URL [英] Rewriting a number based URL using .htaccess RewriteRule
本文介绍了使用.htaccess RewriteRule重写基于数字的URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将基于数字的简单URL重写为子文件夹?
How can I rewrite a simple number based URL to a sub folder?
我希望 http://mysite.com/123 重定向到该数字可以是1-9999之间的任何数字.我在htaccess中的尝试是:
The number could be anything from 1 - 9999. My attempt in htaccess was:
RewriteRule ^([0-9]+)$ /en/$1/ [R]
但这不起作用.
推荐答案
您的语法正确,我只是在行尾删除斜杠即可,
your syntax is right, I just remove slash in the end of line and it works:
RewriteRule ^([0-9]+)$ /en/$1
这篇关于使用.htaccess RewriteRule重写基于数字的URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文