English 中文(简体)
Mod_rewrite and compounds redirectiontechnology recomend
原标题:Mod_rewrite and complex redirection technique recomendations

试图解决这一问题。 我有一个网站,内容简明:

mysite.com/index.php
mysite.com/faq.php
mysite.com/url.php
mysite.com/users/some_content_here

如果用户打电话index 页: 1 BUT如果用户书写像我的现场.com/xgsfd(或比indexfaq有别的其他任何插图)等内容,他们必须称呼“url.php”。

The url. php的文字已经做过,但我对如何解决另一个方面没有任何想法,在根名录中使用“htaccess”文档的想法,但正如你能够看到的那样,这将引发一种无限的退步。

如何解决这一问题的想法? 感谢任何帮助!

最佳回答

如果实际存在,但以其他方式改写给尿素实验室,你可以使用改写条件,为档案、文件夹和短链接服务:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-s
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ url.php?url=$1 [QSA,L]

That way requests to faq.php or index.php will be served, while a request to mysite.com/xgsfd will end up rewritten to url.php?url=/xgsfd .

问题回答

暂无回答




相关问题
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 ...

热门标签