2017-08-11 14 views
-1

我有一個我自己創建的CMS,我有一個外部鏈接,它顯示用戶創建的網頁。PHP - 使URL更小,但具有相同的功能

的鏈接是:http://localhost/CMS/www/users_template/{user_name}

是否有可能更改的鏈接,使其:

http://localhost/CMS/{user_name}

但它應該仍然顯示網頁沒有任何錯誤?

我想我應該編輯我的.htaccess文件,但不知道該怎麼做。我以前從未編輯過.htaccess文件。

+0

你是如何顯示的?你不能修改字符串嗎? – Demodave

+0

關於乾淨網址的搜索 – aidinMC

+0

請參閱:http://httpd.apache.org/docs/current/mod/mod_rewrite.html – CD001

回答

0

這是重複的。

請查看.htaccessremoving part of url path and stay at base

RewriteEngine On 
RewriteBase /CMS/ 

RewriteRule ^www/users_template/(.*)$ $1 [L,R=301,QSA] 
+0

感謝您的回答@demodave - 未來如果您發現重複,請將其標記爲這樣。 – Lag

相關問題