Reputation:
I want to create a dynamic URL using .htaccess file. I designed a website, its URL is:
localhost/social_adv/
I want to create a dynamic URL like below, where the user
is dynamically fetched from the database:
localhost/social_adv/user
Here's my rewrite rule:
RewriteEngine On
RewriteRule ^custom woddev/user [NC,L]
Upvotes: 0
Views: 284
Reputation: 18455
I assume user
is a placeholder and needs to be dynamically set. Try this:
Options +FollowSymLinks
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteRule ^social_adv/(.*)$ /woddev/$1 [L]
</IfModule>
It will match any social_adv/USER
request (where USER
is a placeholder) and maps it to woddev/USER
under the hood. For example, this URL:
localhost/social_adv/shiva
Will be mapped to:
localhost/woddev/shiva
Upvotes: 1