I was following this tutorial to the letter and when I entered my domain name in the browser, I get my page. Except the fact that the browser never masks the domain to www.example.com, instead it changed the domain I just entered and showed me the subfolder preceded by the IP address, for example:

Already done:

  • Installed apache via httpd
  • Created sites-enabled and sites-available folders in /etc/httpd
  • Created .conf file in sites-available with symbolic link
  • Set up permissions to my directories using apache:apache user
  • Added "IncludeOptional sites-enabled/*.conf" string to the end of httpd.conf file.

I have not touched the htaccess file as the tutorial doesn't specify anything about it.

My example.com.conf file:

<VirtualHost *:80>
ServerName www.example.com
ServerAlias example.com
DocumentRoot /var/www/example.com/public_html
ErrorLog /var/www/example.com/error.log
CustomLog /var/www/example.com/requests.log combined
  • Did you install your wordpress before going through this process? I seem to recall that Wordpress hardcodes the domain name into its config files. Might be worth a look at /var/www/example.com/public_html/.htaccess in particular. – Ulrich Schwarz Jan 27 '17 at 6:41
  • Where did you create the files from the linked page? Is your local computer or a remote host? Do you have domain names that you can use? What domain do you enter that it changes? It won't change the name from whatever to "www.example.com" unless it is redirected there, and that's not in the How To you followed. Are you using "example.com" in your files, or replacing it with your domain name? – user207673 Jan 27 '17 at 7:36
  • It's a remote host, if I add the line "IncludeOptional sites-enabled/*.conf" to httpd.conf all folders return a 404, if I don't, I can navigate through the directories using the ip address but the domain returns a 404. – andrralv Jan 28 '17 at 3:05

Please put .htaccess file under public_html folder with below code :

# 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]
# END WordPress

Then try to access your URL

  • Is the folder public_html really necessary? My file structure is /var/www/html/website/wordpress/ and the .htacess file generated by wordpress is located at /var/www/html/ – andrralv Jan 28 '17 at 3:02
  • If your wordpress site document root located at /var/www/html/website/wordpress/ then you need to put .htacess files under path /var/www/html/website/wordpress/ – jayeshkh007 Feb 2 '17 at 8:34

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.