Wordpress .htaccess/template files - wordpress

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.

Related

Unable to change Permalink - Tried tons of tricks

I am using wordpress on godaddy windows hosting. using 4,7,4 version of wordpress.
For some reason permalinks do not work in any mode except of plain, selecting any other structure results in 404 errors at all pages except of home. I know there is a ton of similar questions, but none of the existing solutions does not help (at least all solutions I could find).
.htaccess file is changing when permalink structure is modified, it adds a code that looks as it supposed to be:
# 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
Giving different permissions doesn’t do anything.
According to the hosting provider the web server meets all requirements
The website is using woocommerce. Disabling all plugins was tried as well – no effect.
Any other ideas how can I fix this or at least where the problem is? Thanks in advance
You may need to enable mod_rewrite to accept the server to access the formatted URL's
Edit , httpd.conf
AllowOverride all
Also inside php.ini remove ; from the below extension,
extension=php_curl.dll

WordPress: Non-existent pages are being loaded

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

Wordpress htaccess not a directory rule keep firing anyway

I have a strange problem with a site i installed on my server, the same exact code works elsewhere so i'm stuck here trying to figure out what is not working.
# 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
This is the standard Wordpress htaccess. Technically, the "!-d" rule should allow me to list or access any directory but in this install, it's not the case.
I have a "admin" folder and wordpress keeps kicking in and handling the admin url as "wp-admin" but thats not what i want. I already have other servers where i have a custom "admin" folder mixed with wordpress and it launches fine but something strange here seems to be hapenning.
What we have done:
Disable the rewrite engine, wordpress turns off the folder responds
Disable/Reenable the rewrite engine (to flush possible existing rules) nope
Tried to add "RewriteCond %{REQUEST_URI} !^/admin", doesn't work, WP still kicks in
Can you guys suggest anything else?
After some testing we found out that wordpress was catching all error messages even the 401 on our server. It kept showing 404 because thats the only rendered error by Wordpress.
To this end, we just put a
RewriteEngine Off
In the folder we were trying to access and blam! all of it works now!
I hope this can help others!

Cant create new pages - wordpress. Possible Mod-rewrite error?

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

Wordpress - avoid opening php files as pages?

I have some php scripts in my Wordpress directory and I'm unable to use them. Why? Because Wordpress treat them as posts.
For example:
http://kaptinlin.com/themes/striking/wp-content/themes/striking/includes/sendmail.php
Points to a file and it works.
But on my site when i try to open /wp-content/themes/myTheme/anyDictionary/anyfile.php
it loads:
Not Found
Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.
Page.
How to fix that?
Thanks
The default WordPress mod_rewrite rules look something like this:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
In essence, this says "pass all requests through WordPress, unless the request corresponds to a real file or directory." So, if you're seeing a WordPress delivered page when you expect the output of a non-WordPress script:
Your rewrite rules differ from the default; paste them for help debugging. Or,
The file may not exist where you think it does.

Resources