我在我的網站上創建了一個文本鏈接。如何顯示用戶定義的(漂亮)網址
當鏈路上的用戶點擊,就帶他到一個頁面:
www.example.com/toronto_streets.php
但是,我想顯示爲www.example.com/toronto.on/
那麼當用戶從該頁面選擇一個街道的URL ,將URL
www.example.com/street_landing_page.php?street=Option
但是,我想爲www.example.com/toronto.on/house-for-sale-option
我與編輯試圖要顯示的URL荷蘭國際集團.htacccess文件,但沒有工作......
這是我加入的.htaccess文件:
RewriteEngine on
RewriteRule ^toronto.on/house-for-sale-condo-mls/?$ house-for-sale-condo-mls.php [NC] #...
所以將上面的行重定向到www.example.com/toronto.on/house-for-sale-condo-mls/
www.example.com/house-for-sale-condo-mls.php
?
當林調用URL,www.example.com/toronto.on/house-for-sale-condo-mls/
,即時得到這個錯誤:
請求的URL /toronto.on/house-for-sale-condo-mls未找到 此服務器上。
更新:
這是我目前的.htaccess文件。它將www.example.com/toronto.on
重定向到一個名爲cate.php
的頁面,其城市值='toronto'和省='on'。
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example\.com
RewriteRule ^(.*)$ example.com/$1 [R=permanent,L]
你需要對Apache擴展'mod_rewrite'做一些研究,你可以做類似的東西;你試圖寫入.htaccess的是什麼? – 2015-01-26 21:22:23
,並且需要在您發送給客戶端的任何html中嵌入您的「友好」網址。如果您發送的HTML包含內部「醜陋」的URL,那麼mod_rewrite的大量修改都不可能在客戶端的瀏覽器中修復一個URL。 – 2015-01-26 21:23:58
我編輯了這個問題,以反映我使用.htaccess文件 – MPK 2015-01-26 21:46:01