Jump to content

mod rewrite & create subdomain ?


ahadsalim

Recommended Posts

Hello
I have a website like weblog that user can register and write their Post and publish them !
but i have some problem to rewrite url !
i want when user type : something.mysite.com
redirect to mysite.com/blogindex.php?u=something
I install wild card and it redirect all addresses & i use this in .htaccess
[code]RewriteEngine On
# Extract the subdomain part of domain.com
RewriteCond %{HTTP_HOST} ^([^\.]+)\.domain\.com$ [NC]
# Check that the subdomain part is not www and ftp and mail
RewriteCond %1 !^(www|ftp|mail)$ [NC]
# Redirect all requests to a php script passing as argument the subdomain
RewriteRule ^.*$ http://www.domain.com/blogindex.php?u=%1 [R,L][/code]
but when i type the URL ,redirected in address bar too, i want users don't underestand this !
and the next is ,
when i type somthing.mysite.com/archive.php?70  i want redirect to mysite.com/blogarcive.php?u=something&postid=70



Link to comment
https://forums.phpfreaks.com/topic/29675-mod-rewrite-create-subdomain/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.