• Resolved shinri

    (@shinri)


    Hi

    Firstly, thank you for making a good cache plugin!

    Here is the problem I’m having with my .htaccess file.
    I have WP installed in the \public_html directory but when I try to create subdomains in the cPanel (which would be something like sub.mydomain.com as the URL and which creates directories in the public_hmtl like this: \public_html\sub), then when I try to access it in the browser, the URL is redirected to http://www.sub.mydomain.com/sub/

    I figured there is a problem with my .htaccess file because when I disable the .htaccess file, the subdomains work as they should.

    This is my .htaccess file:

    # BEGIN WpFastestCache
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    AddDefaultCharset UTF-8
    RewriteCond %{HTTP_HOST} !^www\.
    RewriteCond %{REQUEST_URI} !^/wp-login.php
    RewriteCond %{REQUEST_URI} !^/wp-admin
    RewriteCond %{REQUEST_URI} !^/wp-content
    RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
    RewriteCond %{REQUEST_METHOD} !POST
    RewriteCond %{QUERY_STRING} !.*=.*
    RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$
    RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\"]+ [NC]
    RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]
    RewriteCond %{HTTP_USER_AGENT} !^.*(iphone|sony|symbos|nokia|samsung|mobile|epoc|ericsson|panasonic|philips|sanyo|sharp|sie-|portalmmm|blazer|avantgo|danger|palm|series60|palmsource|pocketpc|android|blackberry|playbook|ipad|ipod|iemobile|palmos|webos|googlebot-mobile|bb10|xoom|p160u|nexus).*$ [NC]
    RewriteCond /home/maarika/public_html/wp-content/cache/all/$1/index.html -f
    RewriteRule ^(.*) "/wp-content/cache/all/$1/index.html" [L]
    </IfModule>
    # END WpFastestCache
    # BEGIN GzipWpFastestCache
    <IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE image/svg+xml
    AddOutputFilterByType DEFLATE text/plain
    AddOutputFilterByType DEFLATE text/html
    AddOutputFilterByType DEFLATE text/xml
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE application/xml
    AddOutputFilterByType DEFLATE application/xhtml+xml
    AddOutputFilterByType DEFLATE application/rss+xml
    AddOutputFilterByType DEFLATE application/javascript
    AddOutputFilterByType DEFLATE application/x-javascript
    AddOutputFilterByType DEFLATE application/x-font-ttf
    AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
    AddOutputFilterByType DEFLATE font/opentype font/ttf font/eot font/otf
    </IfModule>
    # END GzipWpFastestCache
    # BEGIN LBCWpFastestCache
    <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf|x-html|css|xml|js|woff|ttf|svg|eot)(\.gz)?$">
    <IfModule mod_expires.c>
    ExpiresActive On
    ExpiresDefault A0
    ExpiresByType image/gif A2592000
    ExpiresByType image/png A2592000
    ExpiresByType image/jpg A2592000
    ExpiresByType image/jpeg A2592000
    ExpiresByType image/ico A2592000
    ExpiresByType text/css A2592000
    ExpiresByType text/javascript A2592000
    ExpiresByType application/javascript A2592000
    </IfModule>
    <IfModule mod_headers.c>
    Header set Expires "max-age=2592000, public"
    Header unset ETag
    Header set Connection keep-alive
    </IfModule>
    FileETag None
    </FilesMatch>
    # END LBCWpFastestCache
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress

    I’ve also tried the suggestions I found in another thread but it didn’t work for me: http://wordpress.org/support/topic/ignore-rewrite-for-subdomains

    https://wordpress.org/plugins/wp-fastest-cache/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Emre Vona

    (@emrevona)

    RewriteCond %{HTTP_HOST} !^www\.
    RewriteCond %{REQUEST_URI} !^/wp-login.php
    RewriteCond %{REQUEST_URI} !^/wp-admin
    RewriteCond %{REQUEST_URI} !^/wp-content
    RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

    if you remove this part, redirection is off.

    Thread Starter shinri

    (@shinri)

    Thank you! It seems to work now. It didn’t have an effect immediately when I changed it but after I waited for a while, it seems to be okay now.

    Plugin Author Emre Vona

    (@emrevona)

    yes but if you save the options, htaccess will be modified.

    maybe I need to add this feature as a option on settings page.

    Thread Starter shinri

    (@shinri)

    That would be useful, I think. 🙂

    Plugin Author Emre Vona

    (@emrevona)

    ok 🙂 shinri, if you vote me, it could make me so happy 🙂

    Anonymous User 12851872

    (@anonymized-12851872)

    Hi,

    I do not see this option?
    Not added?
    I have a friend who has a site in a subfolder http://www.strill.fr/blog/
    if you put the url http://strill.fr/blog/ I am redirected to http://www.strill.fr/
    so, I removed the code you mention above in .htaccess
    but it may return the problem.
    thank you

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to disable subdomain redirections in .htaccess?’ is closed to new replies.