Wordpress serving every page and files as homepage - wordpress

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.

Related

Only default permalinks working WordPress, others permalinks options becomes 404 error

My problem is in my WordPress site only default permalinks are working. When I change permalinks all pages become not found (404). The home page and the shop page is the only working with post name.
Before this problem, I have one more question. that was my site was hacked or may be due to plugin it has some unnecessary files which redirect to some dating site. But I have checked them and delete using WordFence Wordpress plugin. The site is clean now!
This is my .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>
What I did so far?
Change permalinks type and save twist. (nothing work even in a private window)
Change rewrite mode in the database file (clear that field empty and change permalink type. not work)
*Which plugin I have used?
Really Simple SSL
Wordfence Security (pro)
Other plugin related to the theme such as slider revolution, WooCommerce, Contact Form 7 etc. I think they are not that critical to this problem.
I have checked these posts:
only default permalinks working wordpress others become 404 error
After changing domain name of wordpress site only default permalinks working wordpress others returns 404 error
Non of answer work for me. That why I'm post this as a new question here. Also i have post this to https://wordpress.stackexchange.com/ couldn't find an answer yet.
Thank you

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 permanent link htaccess issue

My WordPress site has permanent link issues - .htaccess
In the WordPress Permanent link section,
1) When I select the post name URL (www.myworld.org/sample-post/) it's not working. Actually it's throwing the 404 error whenever linked to sub pages of the web site.
eg: www.myworld.org/aboutus/
2) When I place the custom link with %index.php% it works fine (www.myworld.org/index.php/%postname%/). However all the sub pages URL coming with index.php
eg: www.myworld.org/index.php/aboutus/
I want to get rid of the index.php in all the sub pages URL.
3) Actually my website files are placed into one separate folder on the root.
eg: /newsite/... (all WordPress files wp-content, wp-include, wp-admin etc.)
Also I've placed .htaccess file inside /newsite/ directory along with other WordPress files.
eg: /newsite/.htaccess
My .htaccess file below:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ./index.php [L]
</IfModule>
Even I've .htaccess file However I've 404 page issue when change the permanent link to postname.
eg: www.myworld.org/sample-post/
Try to change URL structure from Post Name to Plain and refresh your website ... once you have done check you front end page if it shows proper URLs, After doing this, revert back your Permalinks to Post Name ... hope that will fix your issue ... your .htaccess file is looking standard one at the moment.

Wordpress permalinks with files and folders out site of Wordpress

I have a wordpress site and I also have pages/files/folders that I've created outsite of wordpress. Right now, I have no permalinks with my URLs as site.com?p=123. I want to have permalinks (pretty links) as site.com/postname (I know the permalink string is /%postname%/). I also have pages that are on my site that have nothing to do with the wordpress site.
When I changed the permalinks in wordpress, all my posts work fine just like they should. But when I try going to an outsite wordpress page/folder like site.com/file_name.php or site.com/folder_name/ I get HTTP 404 not found.
Is there a way that I can do this, or am I stuck with having just the post id permalink?
The default WordPress .htaccess configuration for permalinks should handle files that exist on the file system outside of WordPress. You can read about using permalinks in the Using Permalinks documentation on WordPress.
Of note is the snippet that you're supposed to include in .htaccess (so maybe update your .htaccess file to contain this content):
# 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
The RewriteCond clauses tell WordPress that if the current URL either points directly to a file or to a directory, then WordPress will ignore it and let the file load normally.
Open up the Wordpress .htaccess file after enabling SEO permalinks and add the following line on top:
ErrorDocument 401 default
Let me know if that works, or you can always explicitly allow those specific files/folders in the .htaccess file.

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

Resources