• ledbelly2142

    (@ledbelly2142)


    A site I am working on has some strange configuration I am challenged to figure out. First, the site and home url are different, which is generally fine if your wp install dir is in a different directory than root… This is a single site with one root dir.

    The site url is http://www.example.com and the home (wp address) url is example.com (without the www). There are no redirects in the .htaccess file. The site works like this. When you log in, the admin pages are redirected to example.com/wp-admin instead of http://www.example.com/wp-admin

    If I match the site and home url to http://www.example.com, I can login to http://www.example.com/wp-admin with no problem, however all the site links (images, etc…) are broken and have a http://www.www.example.com/whateverpathtoimage…

    Aside from the htaccess file, where else could the redirect be coming from?

Viewing 7 replies - 1 through 7 (of 7 total)
  • petercralen

    (@petercralen)

    Check also if you have some SEO or redirect or login / admin plugin.
    Also sometimes hosting can have some special redirects somewhere.
    Do you use default .htaccess file?

    In settings – general – are your url – WordPress URL and Site URL right?
    Also check config.php in root directory of wp if there is not some path.

    Thread Starter ledbelly2142

    (@ledbelly2142)

    Yup, have a default htaccess file. simple stuff. I don’t have access to the config.php, but I have can view the server.apache file, what is strange is that there are two ServerAlias entries:
    example.com
    http://www.example.com

    Not sure if this is a potential issue or just allows either prefix domain to work.
    Normal stuff in the htaccess:

    <IfModule mod_deflate.c>
        <IfModule mod_headers.c>
            Header append Vary User-Agent env=!dont-vary
        </IfModule>
            AddOutputFilterByType DEFLATE text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon application/json
        <IfModule mod_mime.c>
            # DEFLATE by extension
            AddOutputFilter DEFLATE js css htm html xml
        </IfModule>
    </IfModule>
    IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    RewriteEngine on

    Not sure why there would be two RewriteEngine on statemenets… just need one.
    Aside from basic google analytics, there are no SEO modules, so no redirect there.

    Every other site I have done have both the site address and wordpress address as the same. The only way the site will work (with correct links to images) is if the WP url is example.com and the site address is http://www.example.com

    Which totally baffels me, the wordpress url should be different only to direct the WP install to a different directory (other than the root directory). So adding www in front of the wordpress address creates the problem of all media having an extra http://www.www.example.com/path.to.media&#8230;

    Could it have been that at some point in the past the database was changed for all media, sort of a search and replace?

    What scares me is that there is an inactive plugin called Velvet Blues Update URLs. It was written to update permalinks and urls embedded in content. If someone used this in the past and rewrote all the images to http://www.example.com, then they are hardcoded in the database that way.

    This makes the most sense with the extra http://www.www.whatever

    I tried to verify hard coded links by looking at the database with the wordpress address with and without www. I found links in the db had http://www.www wiht the WP address set to http://www.example.com, and links has a single www. with the WP address as example.com.

    Why would anyone do this? and how to fix it?

    petercralen

    (@petercralen)

    What scares me is that there is an inactive plugin called Velvet Blues Update URLs.

    Uninstall anything what you don’t use. Also disable all plugins/theme and see if problem still exist.

    Not familiar with mod deflate, my default .htaccess in WP is

    # 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

    Btw. if you or whoever hardcoded something in database or wherever then it will be hard to help you. If you build playground yourself, your rules applies there 🙂

    i dont know why are you trying to fix what is not broken.anyways to get the issue of broken images fixed you will have to change their URL in Database ,which is very time consuming job. you will have to use the deactiveated plugin for that.

    activate the Blue Velvet plugin and navigate to the plugin page
    replace http://www.www.example.com/ as old URL and
    new URL as http://www.example.com as new URL, tick the checkox which says URL for Attachments and press ‘update url now’. it should be fixed

    Remember to take database backup before running it though.

    Thread Starter ledbelly2142

    (@ledbelly2142)

    There is an issue somewhere where the dns on some networks will only resolve to http://www.example.com, so if you sign in from one network all is fine. If you sign in from another network, then there is an admin login loop that keep toggeling from http://www.example.com to example.com

    Ializ, you think the best way to resolve this is to use the Blue Velvet plugin to change the hardwired urls?

    Have you used the Blue Velvet plugin?

    Yup, always backup.

    you can fix broken images with velvet blue. in past i have used it on 100+ websites., it is time saver.

    Thread Starter ledbelly2142

    (@ledbelly2142)

    Thank you for the recommendation. Will do.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Admin pages is missing www causing issues’ is closed to new replies.