Recently added a domain name and there are pages/links that still include the IP address and when pressed redirects from http://ipaddress/subfoldersite/folder to mydomain.com. I have multisite network and my subfolders site has this issue. Is it related to .htaccess? What has to be changed to fix this issue?

Current .htaccess file:

    <IfModule mod_rewrite.c>
RewriteEngine On 
RewriteCond % 80 
RewriteRule ^(.*)$ https://mydomainname.com/$1 [R,L]

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
  • That redirect isn't being triggered by your htaccess file, although the first rule in your file appears to be malformed (http to Https redirect) and wouldn't do anything in its current state. However, you do need to fix these links in your app, not just rely on a redirect.
    – DocRoot
    Dec 16 '19 at 14:29
  • Maybe you know from where it could come then and how to fix it? I checked the database and links are fine in there.
    – San F
    Dec 16 '19 at 18:15
  • Thank you for the info! Fixed the problem. The posts- in this case, listings had to be resaved and after that the link updated.
    – San F
    Dec 16 '19 at 18:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.