2012-05-27 32 views
-1

我的如下鏈接(的index.php):如何爲此配置.htaccess文件?

<a href="http://localhost/example-link.html">Example Link</a> 

也許我的鏈接如下:

<a href="http://localhost/other.html">Other</a> 

當點擊我想「例如,link.html」鏈接IR 「other.html」 從cat.php

Cat.php

<?php 
echo $_GET["cat"]; 
?> 

我想打印$ _GET [ 「貓」(例如,link.html或other.html)

+1

你的問題是根本不清楚。請清楚解釋你的要求。 – anubhava

回答

1
RewriteEngine On 
RewriteRule ^(.+)\.html$ cat\.php 

我想打印$ _GET [ 「貓」(例如,link.html或other.html)

預定義變量$_SERVER包含的一些信息,或許REQUEST_URI

+0

我覺得你不明白。 example-link.html僅用於示例:)(在某種意義上的變量) – Birlikisgu

+0

爲什麼不讓您的問題更易於理解,以便人們可以充分了解自己的知識? –

+0

查看編輯答案。全面的規範http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html – Filype

0
# Redirect old file path to new file path 
Redirect /example-link.html http://localhost/cat.php