Wordpress permalinks broken - wordpress

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.

Related

How to block access to file directory via browser?

I use VPS hosting and Debian, then i installed Wordpress. I upload file in one specific file and unfortunately it is accessiblevia browser:
qartulad.online/wp-content/movies/2018/
People can access to every file on this directory. But people cannot access to other Wordpress directory:
qartulad.online/wp-content/
How can i block access to my specific directory too?
How is the access on this domain blocked?
ftp01.srulad.net/hd3/cfb32710293800d2c041409ae665c998/
You have multiple ways to do this.
You can do it on the server level via the httpd.conf or .htaccess. (httpd is the best spot to do it)
In the httpd.conf
Look for Options Indexes FollowSymLinks
Change it to Options FollowSymLinks
In the .htaccess add before the WordPress block.
Options -Indexes
There are also plugins that will do it. iTheme Security has more or less a one click that does a lot of the basic security like directory surfing etc.

Wordpress Directory Switch Issues

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.

Bitnami wordpress htaccess.conf setup

I am using xampp to develop a wordpress site using bitnami application installer all is fine at the moment except that there is no .htaccess file but instead they are using a htaccess.conf file. would i be able to create a .htaccess file in order to allow .svg mime type? or is there a way to do that with the htaccess.conf file?
I appreciate the help :)
Bitnami developer here:
One of our main goals is to configure Bitnami applications in the most secure way. For this reason, we moved the configuration in the ".htaccess" files to the main application configuration files and set the "AllowOverride" option to "None" by default.
In this case, you have two options:
Set the AllowOverride directive to All in xampp_dir/apps/wordpress/conf/httpd-app.conf and use the .htaccess files.
Use xampp_dir/apps/wordpress/conf/htaccess.conf with the content of the .htaccess files that you have.
I hope it helps.

Htaccess on XAMPP local server for testing

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).

404 error on drupal after migrating

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.

Resources