• We value your experience with Plesk during 2024
    Plesk strives to perform even better in 2025. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2024.
    Please take this short survey:

    https://pt-research.typeform.com/to/AmZvSXkx
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Question Preview URL wrong in domain view

Stettin

New Pleskian
Server operating system version
Ubuntu 22.04
Plesk version and microupdate number
Version 18.0.62 Update #1, last updated on July 7, 2024 01:18 AM
I have a website that I migrated to Plesk several months ago. It works fine, but the preview and document root on the domain overview are wrong. I have all my physical files in mysite.net/blog with WordPress configured with .htaccess to rewrite the url as if all the pages are right after the .com.

My URL preview of the site shows "404 not found" of my actual website as the URL it is previewing has /blog appended, which will never work. I'm trying to find a place to change it to just the root (httpdocs), but everywhere I find it, that is the setting, with no /blog. For example in Hosting Settings it shows document root "httpdocs".

In the overview next to Files link, it says "at .../blog" and links the the files at httpdocs/blog. At the very bottom of the domain tab, it says Website at httpdocs, with a correct link to that directory.

Any idea how I can change it so my website shows up in the portal correctly? The website itself works just fine with the rewrite.
 

Attachments

  • plesk-blog.png
    plesk-blog.png
    87.2 KB · Views: 12
  • plesk-blog2.png
    plesk-blog2.png
    51.8 KB · Views: 13
Hello, I guess there can be a conflict between preview settings and URL rewriting in .htaccess, I think it is more correct to change the document root to /blog and remove URL rewriting
 
@Stettin do I understand correctly that your .htaccess resides in /httpdoccs, but all other file in /httpdocs? Could you post a copy of your .htaccess file here?
 
@Stettin do I understand correctly that your .htaccess resides in /httpdoccs, but all other file in /httpdocs? Could you post a copy of your .htaccess file here?

Here is the text of my .htaccess located in /httpdocs

Code:
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]


# BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>


my index.php is as follows:
PHP:
<?php
/* Short and sweet */
define('WP_USE_THEMES', true);
require('./blog/wp-blog-header.php');
?>

All wordpress files are in "/httpdocs/blog/"

Everything in my site works fine, it is just in the Plesk control panel does it think my root directory is /httpdocs/blog/
 
Got it, thanks for sharing.

Plesk uses the URL configured in Wordpress (Settings > General > WordPress Address (URL)) as the point of access for the website. If that URL contains anything that appends the domain, like /blog for example, that will get added to the preview URL too.

What you can do to mitigate this is to the the website document root the httpdocs/blog instead. To do you need to:
1) remove the /blog from the URL's configured in Wordpress (Settings > General).
2) append the document root for the domain in Plesk, via Hosting & DNS tab > Hosting > Document root, with /blog

Make a backup from your site just in case anything goes wrong.
 
Got it, thanks for sharing.

Plesk uses the URL configured in Wordpress (Settings > General > WordPress Address (URL)) as the point of access for the website. If that URL contains anything that appends the domain, like /blog for example, that will get added to the preview URL too.

What you can do to mitigate this is to the the website document root the httpdocs/blog instead. To do you need to:
1) remove the /blog from the URL's configured in Wordpress (Settings > General).
2) append the document root for the domain in Plesk, via Hosting & DNS tab > Hosting > Document root, with /blog

Make a backup from your site just in case anything goes wrong.

Without actually trying your suggestion, I think it is something I'd rather not do. I'll just deal with the preview not working correctly. I have a secondary website (not subdomain or Wordpress) that I host off of the httpdocs/site2 directory. If I change the document root in Plesk, that defeats the purpose of having my Wordpress website files in an upper directory like /blog. I think maybe this was a security "plus" back when Wordpress was not as widely used, as I'm sure a hacker will try /blog if they get access to my site.
 
Back
Top