0

I've followed https://ubuntu.com/tutorials/install-and-configure-wordpress to install and configure wordpress on an Ubuntu 20.04 machine. I can access the example site at .../blog and administer it at from .../blog/wp-admin as expected.

How do I change it so that instead of being available at .../blog it is available at either .../somethingelse or just http://myserver.example.com ?

I'd have expected https://wordpress.org/support/article/changing-the-site-url/ to be helpful but it isn't especially - if I change the "Site Address (URL)" and "WordPress Address (URL)" fields the site no longer functions. I would expect I'd need to change /etc/apache2/sites-available/wordpress.conf so that the "Alias" line in there doesn't refer to "/blog" any more, but there's no mention of that at https://wordpress.org/support/article/changing-the-site-url/ . Similarly there's no reference to /etc/wordpress/config-myserver.example.com.php , although this is presumably the "wp-config.php" that https://wordpress.org/support/article/changing-the-site-url/ refers to.

I'm guessing that Ubuntu (or Debian) have repackaged wordpress so that things are not quite in the same places as they might be on another OS. What exactly do I need to do, button by button, to change .../blog to .../somethingelse ? Obviously, I'm looking for instructions that will work on Ubuntu 20.04 here.

1
  • You should just be able to change the DocumentRoot to point to /usr/share/wordpress, although you might have to do that in the main httpd.conf or a virtual host directive - I don't know how Ubuntu sets up its Apache config. – Rup May 6 at 12:14
0

Those instructions are a little odd to my eye.

I think you're being forced to use /blog because of Step 3 in the instructions. The Apache directive

Alias /blog /usr/share/wordpress

...directs Apache to route any requests to /blog to the directory where you've installed WordPress. (See Apache's docs on the Alias directive.)

I don't know for sure that you'll be able to set your site's root URL (/) to load WordPress, but you should easily be able to use /someotherurl instead. Just modify the /etc/apache2/sites-available/wordpress.conf file and change

Alias /blog /usr/share/wordpress

to

Alias /someotherurl /usr/share/wordpress

You'll need to reload the Apache service for this to take effect, using sudo service apache2 reload as stated at the end of Step 3.

4
  • Thanks - that's at least half way there! If I edit /etc/apache2/sites-available/wordpress.conf so that it reads Alias /someotherurl /usr/share/wordpress sudo service apache2 reload Then myserver.example.com/someotherurl says "Oops! That page can’t be found." A link on that page "UbuntuVM66 Wordpress" goes to myserver.example.com/blog But Apache unsurprisingly says "Not Found" to that URL. – Perplexed May 6 at 23:57
  • However, if I change it back and go to myserver.example.com/blog/wp-admin/options-general.php Both "WordPress Address (URL)" and "Site Address (URL)" are set to "myserver.example.com/blog". So I changed those entries to myserver.example.com/someotherurl and clicked apply The browser redirects to myserver.example.com/someotherurl/… which says "Not Found" – Perplexed May 6 at 23:58
  • So at this point also edit the "Alias" line in the wordpress.conf to Alias /someotherurl /usr/share/wordpress and sudo service apache2 reload myserver.example.com/someotherurl now works OK and so does myserver.example.com/someotherurl/wp-admin – Perplexed May 6 at 23:58
  • If I repeat that process with "Alias / /usr/share/wordpress" in the wordpress.conf, and "DocumentRoot /usr/share/wordpress" (as suggested above) in the /etc/apache2/sites-available/000-default.conf file, I get an error 403 and Apache's error.log has a line with "AH01276: Cannot serve directory /usr/share/wordpress: No matching DirectoryIndex (index.php) found, and server-generated directory index forbidden by Options directive" in it - but there's more for me to look at there, obviously. – Perplexed May 7 at 0:24

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.