Lucky Angelo
Lucky Angelo

Reputation: 65

Convert url to look like subdomain

How can i change my url http://example.com/event_profile.php?event=5 to look like this

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

wheras the event name of event id 5 is event-name

or at least make it

http://event.example.com/5

is this possible with htaccess?

Upvotes: 0

Views: 181

Answers (1)

Abhishek Gurjar
Abhishek Gurjar

Reputation: 7476

Second is possible http://event.example.com/5 because you are having clear value which can be rewritten. try with below rule,

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

Upvotes: 2

Related Questions