I recently set up a digitalocean account with wordpress pre-installed. When it is pre-installed, the directory structure begins in the root (var/www/html/). I wanted to change this, so i moved the files into a new directory (/var/www/html/viralnewz) and changed the wp-config files to represent this (they no longer point to the http://178.62.87.202/ but instead to viralnewz.co.uk, which in turn will point to viral newz directory (/var/www/html/viralnewz). This is set up with a virtualhost, and works fine for the front-page and the admin. But when i try and view others pages, i get a 404 not found. I'm assuming theres an issue with the wordpress setup because it can't find the correct page, however i'm unclear how to actually solve this issue.
Apache conf file
<VirtualHost *:80>
DocumentRoot /var/www/html/viralNewz/
ServerName viralnewz.co.uk
# Other directives here
</VirtualHost>
Additionals to wp-config.php
define('WP_HOME','http://viralnewz.co.uk/');
define('WP_SITEURL','http://viralnewz.co.uk/');
If i've missed any other information that could be beneficial, please mention it and i'll do my best to find it.
Chris
I think your problem can be related to url values stored in DB.
You can migrate safely using this tool, that permit to find and replace the urls stored in DB.
https://interconnectit.com/products/search-and-replace-for-wordpress-databases/
Can be also necessary update .htacess file: normally is enough enter in permalink settings and save again the structure of permalinks.
Related
how are you doing?
I need some assistance in a huge problem that I tried to solve in many ways and I could not.
I have two separated servers one answering by this url www.mysite.com and another by blog.mysite.com.
The server one aka Site (www.mysite.com) there is a proxy to server two aka Blog (blog.mysite.com).
.htaccess
RewriteRule ^blog/?(.*) http://blog.mysite.com/$1 [P]
The wordpress is installed in the Blog server. When I change the Site URL to responde by www.mysite.com/blog the file .htaccess does not update anymore.
For instance:
I get this Error:
And on W3TC:
So, if I put the Site Address equal to WordPress Address the .htaccess update without problems.
PS: This is not a File Permission problem, the permissions are ok. The user/group are correct.
Wordpress don't have a permission for editing .htaccess.
There're 2 solutions:
".htaccess" file should have same user/group owner with PHP (for example, www-data).
You should give write permissions to ".htaccess." In this case give CHMOD 666 permission for ".htaccess" file.
I had a working wordpress site accessible by http://localhost/wp corresponding to the directory /Library/WebServers/Documents/wp. Since I desired to have my wordpress site accessible by http://wordpress without moving the wordpress directory I decided to set a new host in /etc/private/hosts where I added the entry:
127.0.0.1 wordpress
Then I was able to access the site with http://wordpress/wp. To avoid the 'wp' part of the URL I decided to use Apache virtual hosts by adding in /etc/apache2/extra/httpd-vhosts.conf the following block:
<VirtualHost *:80>
DocumentRoot "/Library/WebServer/Documents/wp"
ServerName wordpress
ServerAlias wordpress
ErrorLog "/private/var/log/apache2/wordpress"
CustomLog "/private/var/log/apache2/wordpress" common
</VirtualHost>
Then I restarted Apache and trying to access the site by using the URL http://wordpress I was able to see the written part of the first page but no images and all the links where broken.
Checking out the links I see that the URL they are pointing still contains the 'wp' part I was trying to avoid.
Any suggestion?
Yes, in your database, all of the URLs still have the /wp/ in them. Changing your Apache config did not change this. The easiest way to do this is to use wp-cli (http://wp-cli.org) to do a search and replace on your WordPress database.
BACKUP YOUR DATABASE BEFORE PROCEEDING
wp search-replace 'http://wordpress/wp/' 'http://wordpress/' --dry-run
Assuming you have installed wp-cli and named it wp, the command above will show you all the changes it would make to remove the /wp/. from your URLs.
Once you are happy that it is changing the correct things, remove ``--dry-run` and it will actually make the changes for you.
wp-cli is a powerful tool. We use it for a lot of tasks at http://getpantheon.com and I use it to do a lot of maintenance work on all my personal WordPress sites.
HTH,
=C=
I finally got the XAMPP local Wordpress system working so now I can test things out.
If I want to mimic htaccess files to test redirect code and so forth - especially htaccess in the root - here would I put the htaccess file?
I'm thinking is the XAMPP folder considered the "root"? I've taken a snapshot of my directories to give you an idea. The checkmarks are there just to show you the general layout of the directories.
One other thing - suppose I wanted to create a sub-directory (like localhost/sub/index.php) to test in XAMPP. Is this possible? I noticed when I'm in local host there is no multi-site capability. Thoughts?
Thanks
The .htaccess file should be in the root of your WordPress installation and you may use sub-directories to create more local sites. For example:
localhost/wordpress = xampp/htdocs/wordpress/index.php
localhost/anothersite = xampp/htdocs/anothersite/index.php
// More...
For the WordPress installation, put the .htaccess in the wordpress directory in example (At the same level where the index.php file is stored).
I have a Drupal website in the internet.
I want to work on local from now, so I install Wamp, I copy-pasted the apache filesystem of the website and made a sql dump with phpmyadmin.
I re-create the same database on phpmyadmin with the same name & datas than on the web.
Now, I can access to the main page (the ). All is ok, i see a node, I see the whole menu with links, ...
When I try to navigate or log, it give me 404 error, what is wrong? URL sounds great, when I try ti access to anode with the nodeid, 404 again.
I suspect WAMP but I don't know how fix that problem!
Thanks a lot to help me!
Make sure mod_rewrite is enabled - it isn't enabled by default on WAMP.
You can find instructions on how to do so here.
Most likely you have AllowOverride set to None in Apache. I believe that is the default, and it will prevent your .htaccess files from working (These are the files that make your URLs work).
Edit your Apache config file, search for every instance of AllowOverride and change it to "All", E.g:
AllowOverride All
Also make sure you actually copied the .htaccess file down, sometimes it's hidden.
Make sure you have uploaded the .htaccess file to Drupal's root directory.
Or try to access your website with ?q=, like: http://site.com/?q=admin
Have you installed the local site in a sub folder? What's the local URL?
If the site is located in a subfolder, e.g. http://localhost/drupal, you'll need to add (or uncomment) a line in .htaccess that tells apache about the RewriteBase.
AllowOverride was set to None in my httpd.conf. Changing to AllowOverride All worked like a charm.
Remember to restart apache after the change.
I have recently moved my blog from one serever to another. I am now unable to restore my permalink structure.
Now my permalink strucure has become /?p=123. Whenever, I try to change it to any other custom permalink structure, it throws 404 for all the posts. Check the blog at http://microreviews.org
I have been forced to make the permalink structure as /?p=123. All the entries from search engines are however on the old structure /%postname%/
None of the plugins for the same seem to work and I am stuck with the ?p=123 structure.
What should I do?
Assuming you're on Apache server:
You don't have the .htaccess file on the new server, or
the new server doesn't have mod_rewrite turned on, or
the new server ignores the .htaccess files, or
any combination of the above :)
The other option instead of using .htaccess (although Wordpress is built around modifying that file) you can take the contents of the .htaccess file and add them to a directive in your httpd.conf (or virtual host config file). This approach requires more access to your apache installation (i.e. it might not work with some hosting solutions), but according to the Apache httpd documentation it's more secure and less work on the server since apache will scan every directory for .htaccess files each time a page is accessed and it will re-load the .htaccess file(s) every time the page is accessed as well. If the access is put into the server config then it is loaded once at apache start-up (or on a server reload) and that's it.
For example:
If your .htaccess file contained the following for the /www/htdocs/example directory
AddType text/example .exm
Then the following in your httpd.conf file would be equivalent
<Directory /www/htdocs/example>
AddType text/example .exm
</Directory>
The approach of editing your main configuration instead of .htaccess does not require that you specify AllowOverride to something other than None.
In this case, you'll still need mod_rewrite enabled for permalinks to work correctly.