Note that there are some explanatory texts on larger screens.

plurals
  1. POForward users who use WWW in URL
    primarykey
    data
    text
    <p>Every user on my website get its own URL for usernames like <code>username.example.com</code>. I know that sometimes people are typing <code>www</code> in front the URL. When users do that, they will get redirected by the system to the frontpage. Is there a way to (1) detect the use of <code>www</code>, (2) the username and (3) forward the user to <code>username.example.com</code>, NOT <code>www.username.example.com</code> with PHP?</p> <p>This is not a DNS-releated question.</p> <pre><code>RewriteEngine On Options +Followsymlinks RewriteBase / RewriteCond %{HTTP_HOST} . RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteCond %{REQUEST_FILENAME} !^.*/images/.*$ RewriteCond %{REQUEST_FILENAME} !^.*/uploads/.*$ RewriteCond %{HTTP_HOST}&lt;&gt;%{REQUEST_URI} ^([^.]+)\.bloggify\.no(:80)?&lt;&gt;/([^/]*) [NC] RewriteCond %1&lt;&gt;%3 !^(.*)&lt;&gt;\1$ [NC] RewriteRule ^(.*)$ - [E=BLOGUSER:%1] RewriteCond %{ENV:BLOGUSER} ^(.+)$ RewriteRule ^$ /index.php?w=%1 [L] RewriteCond %{ENV:BLOGUSER} ^(.+)$ RewriteRule ^page([0-9]+)/([^/]+)?$ /index.php?w=%1&amp;page=$1$2 [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^profiles/([^/]+)/([^/]+)?$ /profile.php?u=$1$2 [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^profiles/?$ /profile.php [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^albums/([^/]+)/([^/]+)?$ /album.php?u=$1$2 [L] RewriteCond %{ENV:BLOGUSER} ^(.+)$ RewriteRule ^archive/(.*)/(.*)/([^/]+)?$ /archive.php?w=%1&amp;y=$1&amp;m=$2$3 [L] RewriteCond %{ENV:BLOGUSER} ^(.+)$ RewriteRule ^archive\.php/(.*)/(.*)/([^/]+)?$ /archive.php?w=%1&amp;y=$1&amp;m=$2$3 [L] RewriteCond %{ENV:BLOGUSER} ^(.+)$ RewriteRule ^archive/(.*)/([^/]+)?$ /archive.php?w=%1&amp;y=$1$2 [L] RewriteCond %{ENV:BLOGUSER} ^(.+)$ RewriteRule ^archive\.php/(.*)/([^/]+)?$ /archive.php?w=%1&amp;y=$1$2 [L] RewriteCond %{ENV:BLOGUSER} ^(.+)$ RewriteRule ^archive/([^/]+)?$ /archive.php?w=%1$1 [L] RewriteCond %{ENV:BLOGUSER} ^(.+)$ RewriteRule ^archive\.php/([^/]+)?$ /archive.php?w=%1$1 [L] RewriteCond %{ENV:BLOGUSER} ^(.+)$ RewriteRule ^friends/([^/]+)?$ /friends.php?w=%1$1 [L] RewriteCond %{ENV:BLOGUSER} ^(.+)$ RewriteRule ^friends\.php/([^/]+)?$ /friends.php?w=%1$1 [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^/]+)/friends/page([0-9]+)/([^/]+)?$ /friends.php?w=$1&amp;page=$2$3 [L] RewriteCond %{ENV:BLOGUSER} ^(.+)$ RewriteRule ^([0-9]+)/([^/]+).html$ /entry.php?w=%1&amp;e_id=$1 [L] RewriteCond %{ENV:BLOGUSER} ^(.+)$ RewriteRule ^([0-9]+)/([^/]+)?$ /entry.php?w=%1&amp;e_id=$1$2 [L] RewriteCond %{ENV:BLOGUSER} ^(.+)$ RewriteRule ^&amp;([^/]+)?$ /index.php?w=%1&amp;$1 [L] RewriteCond %{ENV:BLOGUSER} ^(.+)$ RewriteRule ^([^/]+)/([^/]+)?$ /index.php?w=%1&amp;category=$1$2 [L] RewriteCond %{ENV:BLOGUSER} ^(.+)$ RewriteRule ^([^/]+)/page([0-9]+)/([^/]+)?$ /index.php?w=%1&amp;category=$1&amp;page=$2$3 [L] </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload