转换的URL看起来像子域

问题描述:

我怎样才能改变我的网址http://example.com/event_profile.php?event=5看起来像这样转换的URL看起来像子域

http://event.example.com/event-name 

wheras事件ID 5的事件名称为event-name

,或者至少使其

http://event.example.com/5 

这是可能与htaccess?

其次是可能的http://event.example.com/5,因为你有明确的价值,可以重写。用以下规则试用,

RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^([\d]+)$ event_profile.php?event=$1 [QSA,L]