WordPress.org

Forums

Changed in htacces and now cant log in (7 posts)

  1. anderslund78
    Member
    Posted 3 years ago #

    Hi,

    I have a website (http://koereskole-svendborg.dk/) - as default it did not have www in front og the url and I tested some different htacces such the one below with no succes. I did not change any setting in WordPress where it is set to not have www in front on the urls.

    After testing the htacces below in put in the original htacces - see below. But now I cant login on my wordpress installation anymore - what do I do to login and to solve the htacces issue?

    RewriteEngine on
    RewriteCond %{HTTP_HOST} !^$
    RewriteCond %{HTTP_HOST} ^www.(.+)$ [NC]
    RewriteRule ^/(.*) http://%1/$1 [L,R=301]

    Original:
    # 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

  2. GioV1195
    Member
    Posted 3 years ago #

    Try downloading a fresh install of WordPress, unzip it and upload a fresh copy of the .htaccess file to the root of your server.

    If you want to have the www on your URL, just go to Settings -> General and add "www." (without quotation marks) to the beginning of your URL.

  3. GioV1195
    Member
    Posted 3 years ago #

    Whoops. Turns out you can't get a fresh .htaccess, but here's how the default one looks like:

    # 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

  4. anderslund78
    Member
    Posted 3 years ago #

    Hi,

    If you read my post I have gone back to the original htaccess text which you also posted. I am confused - how do I solve this?

  5. adpawl
    Member
    Posted 3 years ago #

    Check something like that:

    RewriteCond %{HTTP_HOST} ^www.koereskole-svendborg.dk$ [NC]
    RewriteRule ^(.*)$ http://koereskole-svendborg.dk/$1 [R=301,L]

  6. You don't need .htaccess rules to remove www from the URL. Remove the www in Dashboard>>Settings and in .htaccess, remove the rewrite rules that remove the www.

  7. anderslund78
    Member
    Posted 3 years ago #

    Hi,

    This htacces text below works for me but the sub-pages get an 404 error. And I cant login to my wordpress installation with this text or the original htaccess text - anyone can help me to be able to login again. Do I need to change anything in phpMyadmin?

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^www.koereskole-svendborg.dk [NC]
    RewriteRule ^(.*)$ http://koereskole-svendborg.dk/$1 [R=301,nc]

    Songdogtech - could you provide the htacces text for this. I will try this solution when I hopefully soon can login again :-) the www has been in removed in the wordpress settings all the time.

Topic Closed

This topic has been closed to new replies.

About this Topic