• Hi,
    I’m trying to create a rewrite rule in my .htaccess file, but it doesn’t work.
    In particular, I need a single page to be redirected to another page, if the user is using a mobile device to see it.
    The .htaccess file is in the root-directory, that in my case is a sub-directory (www.miosito.it/sezione/)

    I’ve tried this code:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /sezione/
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /sezione/index.php [L]
    
    RewriteCond %{HTTP_USER_AGENT} "android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|opera mobile|palmos|webos" [NC]
    RewriteRule ^/trova-i-nostri-punti-vendita/ https://www.miosito.it/sezione/trova-i-nostri-punti-vendita-mobile/ [L,R=302]
    
    </IfModule>

    Than I tried to change this string:

    RewriteRule ^trova-i-nostri-punti-vendita https://www.miosito.it/sezione/trova-i-nostri-punti-vendita-mobile/ [L,R=302]

    Unfortunately nothing happened and the mobile users are not redirected (they see the desktop version of the page).

    Have you any idea of the reason it doesn’t work? Maybe is due to the position of the .htaccess? I don’t know what else to think ??

    Thank you very much

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Single page/post redirect by .htaccess’ is closed to new replies.