Reputation: 393
I have a site which you can create a network but I have a problem to create a fake folder.
Normal url;
mysite.com/profile.php?id=123&network=stackoverflow
What I want is
mysite.com/stackoverflow/profile.php?id=123
another example
Normal url;
mysite.com/home.php?network=stackoverflow
What I want is
mysite.com/stackoverflow/home.php
What is the htaccess code for this? Thanks for your help
Upvotes: 0
Views: 1093
Reputation: 2086
Try this:
RewriteRule ^([^\/]+)/(.*)$ /$2?network=$1 [QSA,L]
This will take
yoursite.com/anything_up_to_the_slash/anything.php?anything=anything
And rewrite it to
yoursite.com/anything.php?anything=anything&network=anything_up_to_the_slash
Upvotes: 2
Reputation: 2233
In htaccess you'll need something like this rule:
RewriteRule ^stackoverflow/(home|profile).php /$1.php?network=stackoverflow [QSA,L]
Note that the QSA modifier will make sure that any parameter passed into the url will be passed into the rewritten url.
Upvotes: 0