简体   繁体   中英

Make virtual host, htaccess or php.ini or http.conf or etc?

I want to make a blog system. A popular blog address looks like blogname.sitename.com .

I think that this address should redirect to something like sitename.com/index.php?user=blogname .

Because is not logical that make a subdomain for every blog. Is that correct?

So, I write this code for .htaccess :

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{HTTP_HOST} !^(www|mail).mydomain.com$ [NC]
RewriteCond %{HTTP_HOST} !^(www|mail).mydomain.com$ [NC]
RewriteCond %{HTTP_HOST} ^(www\.)?([a-z0-9-]+).mydomain.com$ [NC] 
RewriteRule ^(.*)/$ ?option=user&id=$2 [R=301,L]

But it does not work. I guess that I should do some configuration another where.

Where is the configuration source? What is the configuration?

使用$ 2代替%2

RewriteRule ^(.*)/$ /index.php?user=$2 [R=301,L]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM