• Resolved testarn

    (@testarn)


    Hi!

    I used to have this code in my htacess file that redirects all urls to www since my website use www.

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^domain.com [NC]
    RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress

    However when i´m using your plugin to change the url with a parent my htacess file is overwritten? and now my site is using both?

    http://domain.com
    http://www.domain.com

    They are 2 different sites now? and i´m only logged in as an admin on the www one.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Maciej Bis

    (@mbis)

    Hi @testarn,

    that is strange, because my plugin does not use rewrite rules and does not modify .htaccess file (there is no need to do this). The custom URIs are detected during pageload (when WordPress PHP functions are executed, with “parse_request” hook), after .htaccess rewrite rules are parsed (they are precedent to any PHP scripts).

    I guess that you probably accidentally flushed the rewrite rules on “Permalinks” admin page:
    /wp-admin/options-permalink.php

    A part of .htaccess code between # BEGIN WordPress and # END WordPress is restored to default setting after “Save changes” button is clicked.

    You should separate your code from the WordPress rewrite rules to avoid overwriting your custom rewrite rules:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} ^example.com [NC]
    RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
    </IfModule>
    
    # 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

    Regards,
    Maciej

    Thread Starter testarn

    (@testarn)

    Thanks, solved! 🙂

    I actually am having similar issue with the plugin, but my case is a bit different.

    1. I set up my domain (during WP installation) to use http://www version
    2. I work on the domain set up all things and everything is fine
    3. I install the plugin, just to manage & edit 1-2 permalinks of Pages
    4. After that, version http://domain.com loads and doesn’t re-direct to http://www.domain.com

    Does it mean I need to use htaccess redirect in such case? The script seems to ignore what’s used in WordPress Address (URL) and Site Address (URL)

    I checked and disabling the plugin makes everything work again, but that’s not the point obviously. 🙂

    What do you suggest in such case?

    • This reply was modified 8 years, 5 months ago by questiononly.
    • This reply was modified 8 years, 5 months ago by questiononly.
    Plugin Author Maciej Bis

    (@mbis)

    Hi @questiononly

    could you contact me via email contact@maciejbis.net.

    Regards,
    Maciej

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Plugin overwrites htacess’ is closed to new replies.