Note that there are some explanatory texts on larger screens.

plurals
  1. POProblems with configuring Apache for mobile website
    text
    copied!<p>I am having some trouble with configuring Apache for a website that has both a normal and mobile version. The idea was to redirect the user with a mobile browser automatically to the mobile version and if someone on a normal desktop PC is trying to connect to the mobile version to redirect it to the normal website.</p> <p>Right now it redirects a mobile user to the mobile website correctly. But it is seems to be unable to redirect the other way to the desktop version. Also, when you go to the mobile version of the website, it displays the default "It works!" page instead of the mobile index page for some reason..</p> <p>Here is all the configuration that I used. Hopefully someone is able to help me out with this. Thanks in advance! Normal website:</p> <pre><code>&lt;VirtualHost *:80&gt; ServerAdmin webmaster@henal.local ServerName henal.local ServerAlias www.henal.local DocumentRoot /var/www/henal.local &lt;Directory /&gt; Options FollowSymLinks AllowOverride None &lt;/Directory&gt; &lt;Directory /var/www/henal.local&gt; Options Indexes FollowSymLinks MultiViews AllowOverride All DirectoryIndex index.html Order allow,deny allow from all &lt;/Directory&gt; ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ &lt;Directory "/usr/lib/cgi-bin"&gt; AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all &lt;/Directory&gt; ErrorLog ${APACHE_LOG_DIR}/deltionkrant/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel debug CustomLog ${APACHE_LOG_DIR}/deltionkrant/access.log combined Alias /doc/ "/usr/share/doc/" &lt;Directory "/usr/share/doc/"&gt; Options Indexes MultiViews FollowSymLinks AllowOverride None Order deny,allow Deny from all Allow from 127.0.0.0/255.0.0.0 ::1/128 &lt;/Directory&gt; &lt;/VirtualHost&gt; </code></pre> <p>.htaccess normal website:</p> <pre><code>RewriteEngine On RewriteCond %{HTTP_USER_AGENT} "android|blackberry|googlebot- mobile|iemobile|ipad|iphone|ipod|opera mobile|palmos|webos" [NC] RewriteRule ^$ http://m.henal.local/ [L,R=302] </code></pre> <p>Mobile website:</p> <pre><code>&lt;VirtualHost *:80&gt; ServerAdmin webmaster@henal.local ServerName m.henal.local ServerAlias henal.local DocumentRoot /var/www/henal.local/mobile &lt;Directory /&gt; Options FollowSymLinks AllowOverride None &lt;/Directory&gt; &lt;Directory /var/www/henal.local/mobile&gt; Options Indexes FollowSymLinks MultiViews AllowOverride All DirectoryIndex index.html Order allow,deny allow from all &lt;/Directory&gt; ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ &lt;Directory "/usr/lib/cgi-bin"&gt; AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all &lt;/Directory&gt; ErrorLog ${APACHE_LOG_DIR}/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog ${APACHE_LOG_DIR}/access.log combined Alias /doc/ "/usr/share/doc/" &lt;Directory "/usr/share/doc/"&gt; Options Indexes MultiViews FollowSymLinks AllowOverride None Order deny,allow Deny from all Allow from 127.0.0.0/255.0.0.0 ::1/128 &lt;/Directory&gt; &lt;/VirtualHost&gt; </code></pre> <p>.htaccess mobile webiste:</p> <pre><code>RewriteEngine On RewriteCond %{HTTP_USER_AGENT} "!(android|blackberry|googlebot- mobile|iemobile|ipad|iphone|ipod|opera mobile|palmos|webos)" [NC] RewriteRule ^$ http://www.henal.local/ [L,R=302] </code></pre>
 

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