Wordpress Permalink Issue w/ Subdomains - wordpress

My setup: I have domain.com pointing to Server 1 and have set up blog.domain.com to point to another wordpress Server 2 that hosts multiple wordpress sites. Server 2 has multiple wordpress sites in a single Ubuntu server as per these instructions. Because this manual is outdated, I also follow wordpress virtual host configuration based on Step 4 detailed in this post. Describing my setup up front because I'm not sure if my problem is because of this setup.
Question:
Based on this setup, Wordpress works fine with the default permalink option. Below are the details in my conf file
DocumentRoot /var/www/domain
ServerName blog.domain.com
ServerAlias blog.domain.com
<Directory "/var/www/domain">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
When plain permalinks are selected, my htaccess file in /var/www/domain is empty and everything works fine.However, when I change the permalink to Post name (blog.domain.com/sample-post/) the homepage (blog.domain.com) works fine but my individual post url (blog.domain.com/sample-post/) does not work. My htaccess file looks like this:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
WordPress Address (URL) = blog.domain.com
Site Address (URL) = blog.domain.com
Could you please help resolve this. I'd like permalinks to be enabled but have been stuck with this issue for several months. Really appreciate all your comments & feedback.

I was able to resolve this by following instructions by Robert in this thread - WordPress Multisite 404 error on posts and subsites

Related

Moving Wordpress multisite to localhost for development

I've been trying to copy my multisite of a domain and moving it to
C:/wamp/www/at-groep
I configured wp-config.php, .htaccess correctly. I created virtual hosts etc. I will give some examples of what I did. The error message I get is:
If your site does not display, please contact the owner of this
network. If you are the owner of this network please check that MySQL
is running properly and all tables are error free.
Could not find site at-groep.local. Searched for table atgroep_blogs
in database at-groep. Is that right?
What do I do now? Read the bug report page. Some of the guidelines
there may help you figure out what went wrong. If you’re still stuck
with this message, then check that your database contains the
following tables:
atgroep_users - atgroep_usermeta - atgroep_blogs - atgroep_signups
atgroep_site - atgroep_sitemeta - atgroep_registration_log -
atgroep_blog_versions
I checked if the tables were there, and they were.
Whilst I expected to expected to see the website's root page.
The configuration is like:
This is my .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /at-groep/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /at-groep/index.php [L]
</IfModule>
This is my httpd-vhosts.conf
<Directory "C:/wamp/www/at-groep">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
<VirtualHost *:80>
DocumentRoot "C:/wamp/www/at-groep"
ServerName at-groep.local
Errorlog "C:/wamp/www/ERROR_LOG_AT_GROEP"
TransferLog "C:/wamp/www/TRANSFER_LOG_AT_GROEP"
</VirtualHost>
This is my wp-config.php
/* Multisite */
define( 'WP_ALLOW_MULTISITE', false );
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);
define('DOMAIN_CURRENT_SITE', 'at-groep.local' );
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);
/* That's all, stop editing! Happy blogging. */
I am using Wampserver 2.5.
I expected to see the multisite working on my local machine. Can someone assist me on this one?
Ok the syntax for access rights changed in Apache 2.4 so try amending the Virtual Host definition as follows. Also in my opinion it is better to place the <Directory>...</Directory> set inside the <VirtualHost> section. It at least visually links the 2, although its not illegal to do it the way you did it.
<VirtualHost *:80>
DocumentRoot "C:/wamp/www/at-groep"
ServerName at-groep.local
Errorlog "C:/wamp/www/ERROR_LOG_AT_GROEP"
TransferLog "C:/wamp/www/TRANSFER_LOG_AT_GROEP"
<Directory "C:/wamp/www/at-groep">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Require all granted
</Directory>
</VirtualHost>
If you dont actually want to allow the universe to see your dev site replace
Require all granted
with
Require local
If you want to use another PC in your local network as a client use something like this
Require local
Require ip 192.168.1
Using only the first 3 of the 4 quartiles will allow any ip in that subnet.
Also you will need to add the domain name to your HOSTS file
C:\windows\system32\drivers\etc\hosts
127.0.0.1 localhost
::1 localhost
127.0.0.1 at-groep.local
::1 at-groep.local
Its also a good idea to read and understand how to move a WP website there are some changes you will likely have to make to the database as WP stores the URL that was used when the site was originally installed and uses it internally. This can mess you up when moving a site.
SECOND ATTEMPT
The .htaccess also looks wrong as you have a Virtual Hosts defined rather then running from a sub folder. See if changing the RewriteBase and RewriteRule helps.
.htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Alternatively look at this WP Doc on .htaccess I dont know your exact setup so I cannot suggest anything more specific than this.

Wordpress permalinks fails with virtualhost

I have a wordpress blog in a local server: /var/www/html/blog
(In the root dir '/var/www/html' there are other pages i shouldn't move, so I cant't put the wordpress blog in the root)
I bought a domain name and I've assigned it to this blog with a virtualhost. Then I activated the permalinks in the wordpress blog.
The problem is that when I go to mydomain/index.php or mydomain/, it shows a "Apache 2 Test Page" and in the apache error log it writes this message:
Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden: /var/www/html/blog/
If I go to mydomain/wp-login.php, it's right. If I go to mydomain/section/blabla/, it's right. But the index page fails.
If I comment the .htaccess file I have put in the wordpress blog, the index page works, but pages like mydomain/section/blabla/ doesn't.
This is my virtualhost config code:
<VirtualHost *:80>
ServerAdmin ...Mymail...
DocumentRoot /var/www/html/blog
ServerName ...mydomain...
</Virtualhost>
And this is my .htaccess in the wordpress directory:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Solved.
Finally I moved the blog files to the root apache directory. Then I removed the virtualhost and I created a redirection rule: mydomain/ -> mydomain/index.php
And it works.
Try putting
Options +FollowSymLinks
at the top of your .htaccess file

Wordpress subpages throwing 404 after restoring

I am a newbie to wordpress though I have programming background. Recently I moved a wordpress website from justhost shared server to a
linode vps server (Ubuntu OS). I did following steps to achieve it
Set up apache2 server on vps
Set up virtualhost on vps
Created a directory under /var/www/ftpadmin/www/
Note. ftpadmin was created to restrict ftp access to files under that folder. I could make work static html and php websites after doing so.
Took backup of database and wp-content folder from justhost server of respective wordpress website.
Now on vps, at specified location above, first I download latest version of wordpress and unzipped the files.
Created database of same name at mysql and then imported original to the same database.
replaced new wp-content folder with the one from original one.
I was following instructions on https://www.digitalocean.com/community/articles/how-to-set-up-multiple-wordpress-sites-on-a-single-ubuntu-vps.
restarted apache server. Now I could access the home page.
I corrected the database values for wordpress url and site address url to new one at older location and reloaded database which helped me access dashboard and login pages also.
I created a .htaccess file like mentioned in http://ahsan.vimmaniac.com/blog/enabling-wordpress-permalinks-on-ubuntu/.
I also changed "AllowOveride" under both section in /etc/apache2/sites-available/ as
<Directory />
Options FollowSymLinks
AllowOverride all
</Directory>
<Directory /var/www/ftpadmin/www/domainname>
RewriteEngine On
Options Indexes FollowSymLinks MultiViews
AllowOverride FileInfo
Order allow,deny
allow from all
</Directory>
restarted service apache once again.
One final point, I am using a custom template and so I have a header.php and header-sub.php file for homepage and navigation.
Now here is the problem. When I click on any submenu I get "Internal Server Error".
If I remove .htaccess and reload apache server. Now I get 404 error while clicking on and submenu.
Any help is highly appreciated? I looked at various sites to collate these many steps and execute. I have no Idea what I should do to correct this situation. But when I go dashboard -> All pages, I can find all pages existing there with contents.
Thanks in Advance
Fayaz
EDIT
Added .htaccess file from comment:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wordpress/ (wordpress replaced with my domainname, bottom also)
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
</IfModule>
I got the above problem fixed by just replacing
RewriteBase /wordpress/ as "RewriteBase /"
and
RewriteRule ./wordpress/index.php [L} as "RewriteRule . /index.php [L]".
in .htaccess file.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Finally fixed this errow after browsing for a couple of hours and trying many options.
In this block in your Apache httpd.conf file, (located in my CentOS instance at $ sudo vi /etc/httpd/conf/httpd.conf)
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None
change AllowOverride None to AllowOverride All.
Src: https://wordpress.org/support/topic/secondary-or-child-pages-returning-a-404-error-after-wp-34-update#post-3830892

wordpress multisite with sub-domain pretty permalinks

i am trying to set up a wordpress (3.4.2) multisite. The current site already has the following apache rules applied, which i do not have the permissions to edit
<VirtualHost xx.xx.xx.xxx:80>
ServerName foo.example.nl
ServerAlias www.foo.example.nl
DocumentRoot /web/sites/example.nl/foo/www
RewriteEngine On
<Location />
Allow from all
</Location>
</VirtualHost>
this works fine however i found that trying to set up permalinks with 'Post name' options always gives me a 404 redirect.
http://foo.example.nl/post1 = 404 Not Found
at the moment i have un-installed multisite just to try and get the pretty urls working with the sub-domain but after trying lots of different variations of my .htaccess but nothing seems to be working. here is the current .htaccess wordpress generates:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Unfortunately you are probably limited from using .htaccess to configure the RewriteRules. If you referent to the Wordpress documentation on Using "Pretty" Permalinks you will see that you need to have Options FollowSymLinks enabled as well as AllowOverride Fileinfo or AllowOverride All to be able to use the pretty URL configuration in .htaccess. Since these don't seem to be set your <VirtualHost> it is likely your problem, since they are typically not set at a higher level in the Apache configuration.

permalinks in wordpress

I just moved my wordpress blog from one host to another but permalink is giving trouble. Other than the homepage, other pages give a page not found error.
I edited the htaccess as per instructions
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /projects/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wdmgroup/index.php [L]
</IfModule>
I even tried deleting the htaccess and rewriting but to no avail.
P.S : htaccess and Mod Rewriteare both enabled in Apache's conf
Regards,
Loveleen
Delete .htaccess and reset permalinks from within Admin at Dashboard>>Settings>>Permalinks to be sure permalinks are set in the database as well as in the .htaccess file that WP generates.
Be sure WP is in /wdmgroup/ , because that's where it should be located, according to your .htaccess.
If you're moving WP to root, see Moving WordPress « WordPress Codex.
According to your .htaccess file, your site should be in the http://www.site.com/projects/wdmgroup/ - folder. Is it so? Also, have you update needed entries in the wp_options table in your database?
I found the solution. Everything else was tried but still it didnt work. Later i realized that I had to make a Virtual DIrectory in apache for folder wdmgroup which I had directly placed inside the www folder.
Check your apache configuration and verify that for the directory in which you store your Wordpress installation you have following settings enabled (probably you will have more configuration options for the specific directory, but these are the minimum required for Wordpress fancy permalinks):
<Directory var/www/>
FollowSymLinks
AllowOverride All
</Directory>

Resources