用htaccess更改网址 [英] Changing url with htaccess

查看:84
本文介绍了用htaccess更改网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个PHP网址缩短程序脚本,该脚本可以从 http:// domain .com / go.php?url = 5DIGITID ,但我希望它改为如下所示的URL; http://domain.com/ 5DIGITID

I have a PHP url shortener script that redirects the user from a URL such as http://domain.com/go.php?url=5DIGITID but I want it to instead be a URL like the following; http://domain.com/5DIGITID

域中没有其他目录或文件夹。

There are no other directories or folders in the domain.

如何让我的.htaccess文件调用go.php?url = ID ?

推荐答案

看看面向初学者的URL重写

完成此操作后,请尝试:

Once you've done that, try:

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^([0-9]+)$ go.php?url=$1 [NC,L]
</IfModule>

这篇关于用htaccess更改网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆