Mobile redirect


How can I redirect to ?

Many thanks!

You can use an htaccess 301 redirect.

Something like this should do the trick:

Options +FollowSymlinks 
RewriteEngine On
RewriteCond %{HTTP_HOST} ^ [NC]
RewriteRule ^(.*)$$1 [L,R=301]

Note: Both m and mobile are subdomains which must be created (unless you have wildcard domains setup).

FF: Comments/corrections on your code, if I may:

# Options +FollowSymLinks // not required as this should already be in the httpd.conf
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\\.)?m\\.website\\.com$ [NC] # capture www'd version, too; don't forget to escape the dot characters and the end anchor
# RewriteRule ^(.*)$$1 [L,R=301] # is correct but I prefer to use the {REQUEST_URI} variable with
RewriteRule .?{REQUEST_URI} [L,R=301]

Yeah, very minor comments and very pedantic, I know, but I’ve been helping “newbies” learn the proper regex and mod_rewrite code for many years - too many to get out of that mode.