English 中文(简体)
名声 URLS & Xampp
原标题:Vanity URLS & Xampp

我理解可能还有其他关于虚荣的浮游生物的问题,但是我所见到的每一个人都有不同的代码,我猜他们做同样的工作。 因此我不明白什么规则最适合我的个人问题,这里所说的是我的问题。

我只想创造这个

127.0.0.1/ 网站/概况.php?id=1

至此,

127.0.0.1/ 网站/概况/行政管理

我的子问题也是,

  1. I understand the .htaccess file has to be in the root directory, but is that the root of my website or my xampp htdocs?(e.g c:/xampp/htdocs/ or c:/xampp/htdocs/website)
  2. Using php should i make the conversion between id to username for the URLS on a seperate file then redirect to the requested user s page?

谢谢你的阅读, 我只是不能 似乎得到我的头 周围.htaccess!

最佳回答
  1. Root directory of your website.
  2. No need for redirects. The way it works is that you can map every section of your URL to a URL parameter. For example, http://localhost/profile/Admin is really interpreted as http://localhost/website/profile.php?username=Admin. Only users will see the vanity URL; PHP will still see the URL parameters. In your case, the .htaccess rule will look something like ^profile/([0-9]+)$ profile.php?username=$1 (I obviously don t know for sure since I don t know the architecture of you site).

顺便提一句,您可能会发现虚拟主机很有趣。 它是一种能够为您的网站创建您自己的本地域的方法, 例如 http://my- local-website , 而不是使用 http://localhost/website 或等待制作中的测试。

更多信息:http://sawmac.com/xampp/virtualhosts/

问题回答

暂无回答




相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签