I've changed my permalink structure to be /%year%/%monthnum%/%day%/%postname%/ through wordpress, however, when I go to create a page it does not seem to work.
My .htaccess looks like:
# 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]
</IfModule>
# END WordPress
Do I need to add a new "ifModule" in there for pages? If so, please provide one.
Thanks,
Your .htaccess file and permalink structure won't affect your ability to create new pages, only view existing ones. When you create a new page WordPress uses admin URLs such as /wp-admin/post-new.php?post_type=page to show the form and publish changes.
If you try to save a new page, but it isn't listed in the admin console, then new records aren't being created in your database for some reason. It may be that your server has run out of disk space or your account is over disk quota.
If new pages are being saved, but all pages aren't viewable on your website, then it probably is a permalink problem. The default WordPress .htaccess has always worked for me, and the latest 3.2.1 version generates the same rules you've posted. If you're running on a linux web server that should be okay for both posts and pages.
As a last resort you can switch to the default permalink structures such as /index.php/%year%/%monthnum%/%day%/%postname%/ which doesn't require redirects.
Hope that helps
Related
Our site was recently migrated from a basic php/mysql app to Wordpress. In the old app, we had content in a subdirectory which is now located on a new domain.
Examples below.
Old link:
https://example.com/vibes/vibin.php?showsomething=abcd&whatever=whatever
Should redirect to:
https://vibes.com/vibin.php?showsomething=abcd&whatever=whatever
The complicated angle is that the Old links are now a Wordpress installation. In the default .htaccess file of wordpress I see the following:
# BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
I've poked around in the WP admin area but don't see how I'd safely edit that file.
Is there another way around this or are will our users just have to update bookmarks the old way?
htacess
You can edit the .htaccess file by hand using ftp and add the redirect that you want. Make a backup first. If you want to avoid ftp access then I don't recommend updating the .htaccess file at all because you'll need that access if you break something.
You could use a WordPress plugin to edit the .htaccess file to avoid ftp access, like "Htaccess File Editor." (Please make sure you have ftp access before you try this so you can put your backup back into place if it breaks.)
If you want to redirect all requests then I would look here https://serverfault.com/a/280067 to see how to create a redirect using .htacess that redirects to another domain and also keeps the query string. Maybe it would look something like this.
RewriteCond %{HTTP_HOST} !^vibes\.com [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^/?(.*) http://www.vibes.com/$1 [L,R,NE,QSA]
If you want to only redirect requests to a certain URL on the old site, then I would look here https://stackoverflow.com/a/8416095/222564. Maybe it would look something like this.
RewriteBase /
RewriteRule ^vibes/(.*)$ http://www.vibes.com/$1 [L,R=301,QSA]
plugins
Since the old website is running WordPress, instead of editing .htacess you could use a plugin to redirect requests. There are various "redirect" plugins available. For example "404 Solution" has an option to redirect requests based on a regular expression to another domain and keep the query string. I maintain that plugin so I know it does that, but I don't know about the other plugins.
For example you would redirect from /vibes/(.*) to http://www.vibes.com/$1
I have a wordpress install that is a multisite setup and the site has a DNS pointing to it.
Both the site and home URLs have been changed to the domain.
If i visit the site all the javascript and css files are served as the homepage HTML so everything is broken. Also if you click on any link it delivers the homepage and not the requested page.
I have tried changing the theme to twenty seventeen and disabling all the plugins, but the problem persist.
Any help or direction would be greatly appreciated.
Update:
I moved the site to a subdirectory and changed back to a single site, so now the site is almost a direct clone from its original host, but the problem with every page loading the homepage still persists.
here is the htaccess:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /subdirectory/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /subdirectory/index.php [L]
</IfModule>
# END WordPress
Update 2:
Digging deeper i found that every page has empty query vars which is why its only loading the home page.
add_filter('request', 'overwrite_query', 10, 1);
function overwrite_query($q){
var_dump($query);
}
returns
array(0) {}
Have you tried deleting the htaccess file and trying a new one? I think WP will create one if it doesn't find one.
Please open wp-admin page (Wordpress back-end page) then update permalink. then after work perfectly javascript and css.
I believe a hacker modified the website 'http://bbltechnical.co.uk/' so that loads of dating website show up in Google search results for the website. I have looked for those posts/pages via the dashboard and database, and the don't seem to be anywhere.
(I warn further click-through links on the following page contain explicit content)
Example spam page: http://bbltechnical.co.uk/online-uk-dating/
You can see I have changed the theme of the actual website, yet the theme hasn't changed on the spam pages. Using Wappalyzer I have found the WordPress versions differ. Also the two images in the body text of that page do not exist on the FTP. So I have concluded it is another WordPress set up, sharing the same domain name.
I have cleared the database, flushed out the DNS records, and even spoken to GoDaddy about it. It is such a weird behaviour.
This is the .htaccess file:
# 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]
</IfModule>
# END WordPress
I found it was a modification of 'wp-blog-header.php', at the root of the site, which edited the HTTP header to pull in data from another website.
I used a malware scanner plugin to scan for any changes to the core WordPress files.
Thanks to uvishere's suggestion, I used the plugin 'Sucuri Security' to scan for the changes. Another option is the plugin 'Wordfence'.
I have a Wordpress site that I assumed from another company which structurally is a bit different than other ones I've worked on. I'm primarily a Drupal developer, with enough of a working knowledge of Wordpress to get by.
What the developer who created the site did, is within the themes folder, they created a separate page-whatever-whatever.php file for each page on the site. Some of the content on the pages within the site have been entered through the CMS system - some are hard coded on to the template file.
Previously, it was hosted on a .NET server - we're on LAMP.
It appears that the pages with the hard coded data aren't being called - so the data the client previously saw is just coming up blank. The site appears to be ignoring those page-whatever-whatever.php files and using the default template page instead.
My first guess is that it's an htaccess issue? I just have the generic
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Given the structure they have - is there something else I should be putting in there or changing within the config files?
Thanks in advance!
I guess no issue with .htaccess file. The error was in template file. Enable debug in wp-config.php.
By wp_debug was false.
define('WP_DEBUG', false);
Change this to
define('WP_DEBUG', true);
Now you can see php error in the template file then debug it.
I've been working on my localhost machine developing my wordpress site, and I'm going to export the database and import it to another localhost on another machine. The thing is, I've tried it already and when lets say you click on about it gives a 404 error not found in database. I'm using custom permalink structure /%postname%/
But when in the new localhost I change the custom to default it works. I don't want to /p?=123 at the end of my URL since I already have my links set up. Was wondering how I can set up the links to work?
you need to click on the wamp server, choose the apache menu -> apache modules then move the menu down and choose rewrite_module. You will need the server to restart for the changes to take affect.
If your .htaccess file is writable and mod_rewrite is enabled, WordPress will insert this code when you change the permalink structure. If it is not writable, WordPress will let you know to copy and past this code into the .htaccess
# 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]
</IfModule>
# END WordPress