I have moved a site from my test dev to a live server (its wordpress) and for some reason no matter what page I click on only the homepage loads.
Think I have narrowed it down to my 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
and this line in particular:
RewriteRule . /index.php [L]
If I remove this or remove the htaccess completly I get a Forbidden 403 error.
I was hoping someone could help me figure this out?!
Very common issue is redirect plugin. Disable all plugins and post back. Have you got your website in the root folder or is it in the sub directory?
Update:
Changing the Site URL
There are four easy methods to change the Site URL manually. Any of these methods will work and perform much the same function.
Edit wp-config.php
It is possible to set the site URL manually in the wp-config.php file.
Add these two lines to your wp-config.php, where "example.com" is the correct location of your site.
define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');
This is not necessarily the best fix, it's just hardcoding the values into the site itself. You won't be able to edit them on the General settings page anymore when using this method.
Source
Update:
Goto
wp-config.php
and add
define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');
Turned out there were a bunch of random files in the root, with the FTP I only had access to the public_html. There were a number of htaccess files and other config files which we cleared out and it solved the problem.
Related
I’ve changed my custom permalink setting to /%pagename%/ (which is common, I guess). However, the following problem keeps occurring:
When trying to open a post on my website, I receive a 404 error. When changing the permalink setting back to Standard, the errors disappear.
After googling, I found that there is a way to solve this by editing your .htaccess file. Even after this, the same problem reoccurs. As I would like to have clean page-names, would anyone know how to solve this problem?
Greetings,
Tom
Kindly delete your .htaccess file from the root folder and check your site again, if the problem is still there than regenerate the permalinks using %postname%.
For the url rewriting WP feature to work, WP writes the .htaccess file at the root of your WP installation.
Open the .htaccess file and check whether or not you have this piece of code:
# 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
If it is missing, you have 2 options:
change the file permissions so that WP can write it.
or add the missing code yourself to the .htaccess.
I am trying to set up a Wordpress installation, where Wordpress is in a subdirectory, but where the subdirectory is always rewritten out of the URL.
I've been trying to follow a whole bunch of other questions / posts about doing this, but no one else's solutions seem to work for me, and a lot of the time they just get the pages to load, without removing the subdirectory from the URL, which is crucial for me.
I'm also hoping for a solution that will work the same locally (http://localhost/wordpress) as it will on a live server (http://example-site.com). However, I'll explain the problem from a local point of view:
My root folder is structured like this:
.htaccess
wp /* contains all wordpress core files */
wp-content /* custom wp-content folder, which is set to be pointed at in my wp-config */
wp-config.php
So, if we ignore the .htaccess, the site would be accessed by going to http://localhost/wordpress/wp, and the goal is to access it by just going to http://localhost/wordpress.
This was achieved using this .htaccess:
RedirectMatch 302 /wp/$ /wordpress/$1
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /wordpress/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ wp/$1
RewriteRule ^(/)?$ wp/index.php [L]
</IfModule>
However, at this point, my wordpress installation was set to use default permalinks, which create pages like http://localhost/wordpress?p=12. I need to set this to a different permalink type, which uses URL segments rather than query parameters, like http://localhost/wordpress/hello-world. Once that setting is changed, I can no longer access other pages with that .htaccess (the home page still works fine though)
I tried using this .htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^index\.php$ -
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/wp/$1 [L]
</IfModule>
Which now causes the sub pages to load, though the home page no longer does, nor do some asset files, like http://localhost/wordpress/wp-includes/css/admin-bar.min.css
I can't seem to find a solution that makes everything work at the same time!
I'd also like to mention that I have a very small understanding of writing .htaccess files, so if anyone is going to answer this, please explain things like I am an idiot, as I may not understand you otherwise.
I am considering that you have redirected the domain to the relavant folder, or on shared hosting you have setup the domain to point to your subfolder. I am also considering that you are adding the htaccess to the root. Here is code from the official codex for your situation.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www.)?YourDomain.com$
RewriteRule ^(/)?$ blog [L]
Replace yourdomain.com and blog with website address and directory. Delete everything else from the file. Then goto settings > permalink and change the permalink to what ever you want.
I have installed 404 plugins, I even have a 404 page but I don't know why it is not showing.
My website is one page website and when it should display the 404 page it shows :
Not Found
The requested URL /asd was not found on this server.
Apache/2.2.15 (CentOS) Server at mysite.com Port 80
What can I do to solve this?
you need to add handler for error page in .htaccess file
for example in htaccess file add this code:
ErrorDocument 404 /your404page.php
First check that you have a .htaccess file in your WordPress root folder (the one that contains your wp-config.php file). If it's missing, copy the following text (source) into a new plain-text file called .htaccess in the WordPress root folder. Also, make sure this file is readable by Apache (permissions of 0644 should suffice).
# 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
If that doesn't help, then your Apache server doesn't support the use of RewriteRule directives. This is most likely because mod_rewrite isn't enabled for your particular domain. To fix this, you need to edit the Apache configuration file and add this line to the configuration statements that apply to your domain:
Options +FollowSymLinks
The location of the Apache configuration files can vary depending on your hosting setup, but try looking for a file called httpd.conf in /etc/httpd/conf/.
Check your server's error log too. There might be some useful information in there.
I have problems with one of my Wordpress sites at my host.
Today I installed "Traffic Stats Widget" - plugin and I followed their instructions for installation. So , I did this:
Create a robots.php file on the root directory of your blog: ie public_html/your-blog/ Paste the following code without // in it:
# #
Open .htaccess file in the same directory and paste this in it:
RewriteRule robots.txt robots.php
Make sure you have the 'RewriteEngine On' clause in place...
Make sure you have a robots.txt file, even an empty one, on the root directory
After that I was unable to access all of my subpages.
This is link of my website:
http://idealpvc-dev.com/websites/camel/
And if you try to access some of subpages you will get error 404.
I don't know why, because I restored my .htaccess file but still it doesn't work.
Also I made comparison with others .htaccess file on other wordpress sites but there isn't any differences except folder names.
Any suggestion will be appreciated.
Also, above is content of my .htaccess:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /websites/camel/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /websites/camel/index.php [L]
</IfModule>
# END WordPress
Sites is located at /public_html/websites/camel
Thanks in advance
Make this as a RewrieBase in your htaccess file
RewriteBase http://idealpvc-dev.com/websites/camel/
Instead of this
RewriteBase /websites/camel/
And make your wordpress permalink Default From Wordpress Admin panel > Settings >> Permalink >>> Default
I realized that this question has come up in the past, but I haven't been able to find the solution to my problem.
My wp-admin works fine on my localhost. However, when I migrate to to my live server, I'm no longer able to access it. If I do go to mysite/wp-admin, I get a 404 error.
Some things I've tried:
-Disabling all plugins by renaming the folder
-Deleting plugins one by one
-Changing themes
-Editing permissions to 755 for wp-admin folder
-Adding the below to my wp-config file:
define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');
Note that when I add these lines I get an error that "this page has a redirect loop".
I used the standard wordpress .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
Does anybody have any idea what the issue might be? Any ideas are welcome.
Thanks!
It looks like you've done the standard troubleshooting tests. Try adding the following lines to your active theme's functions.php file.
function flush_my_rules() {
flush_rewrite_rules();
}
add_action('init','flush_my_rules');
Make sure to keep the following lines in your wp-config.php file.
define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');
Then try visiting your homepage first, then your /wp-admin/ page. See if you continue to get a 404. If you do, try visiting the /wp-login.php page, and see if logging in via there continues to return a 404.