I changed the user folder name on my macbook, now I get a 404 when accessing a child page via localhost using my local apache2 server.
I can't 100% guarantee this is what is causing my woes, but that is a major recent change - and since then I can't load interior pages/posts.
eg: http://example.dev/childpage
Homepage loads, WordPress Admin works - just subpages.
Trouble-shooting so far:
Saved Permalinks in the WordPress Admin to regenerate them
Updated /etc/apache2/extra/httpd-vhost.conf
Grepped /etc/apache2/ to verified no old username
Restarted Apache (restarted my computer!)
Grepped /Users/newuser recursively for old username
Followed this post using functions.php and wp-config.php methods and regeneration steps
Verified via phpinfo(); and /etc/apache2/httpd.conf that mod_rewrite is enabled
.htaccess contains typical single site entry
Would be happy to hear from someone who's found the secret key.
Thanks!
Having done all the above steps, and still seeing no success with the typical .htaccess in the docs, I found that adding /index.php/ to the custom slug revives things. This concludes that all hope is not lost and that I just need to take a deeper look at the .htaccess rewrite rules to omit the unsightly index.php.
EDIT:
Answer via:
https://coolestguidesontheplanet.com/403-forbidden-error-wordpress-htaccess/
Add “Options +FollowSymLinks” to your .htaccess file at start of the file:
Options +FollowSymLinks
# 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
Thanks everyone!
Related
I have changed permalink settings in my Wordpress website and now all pages return 404 error.
I have tried the following (none of them worked for me)
Removing .htaccess file and change permalink configuration from Wordpress admin panel so it overrites the file with a correct .htaccess configuration
Cheching whether Apache2 server has Allow Override directive (It has the directive enabled)
Checking file permissions (they are okey -- -rw-r--r-- )
Uninstalling all plugins
Rest api error 404 while trying to configurate WooCommerce
Try calling flush_rewrite_rules (https://developer.wordpress.org/reference/functions/flush_rewrite_rules/).
Just put it into your active theme's functions.php file (e.g. at the beginning) and refresh your page. Then remove it.
Go to Settings » Permalinks, and simply click on the Save Changes button. This will update your permalinks settings and flush rewrite rules. In most cases, this solution fixes the WordPress posts 404 error. However, if it does not work for you, then you probably need to update your .htaccess file manually.
You can also manually add this code in your .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
Okay,
I have a wordpress system https://example.com, everything works fine. Basically I also have zen cart installed in the system. https://example.com/shopcart/ is the url for zen cart.
I am trying to upgrade zencart to the latest version. For which, I have backed up the files and database.
I have uploaded the latest version zencart files to https://example.com/test/ and when I try to load https://example.com/test/zc_install/ I am redirected to a 404 page.
The <title></title> of the 404 page says 'Nothing found for Test Zc_Install'. I am sure wordpress is looking for an article by this name. I have tried many solutions, but it is not working.
Below is my .htaccess:
`<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>`
The system uses permalinks. The permalink is set to custom structure: http://example.com/%post_id%/%postname%/
I know that wordpress loads the root index.php file first and prepares the query. Is it possible to temporarily stop wordpress behaviours and allow me to access the URL https://example.com/test/zc_install/ ?
Any help would be extremely appreciated. Thank You.
The WordPress apache rewrite is catching all of your requests when they come into the website root directory.
You could add the following to the top of your Rewrite Rules:
RewriteEngine On
RewriteBase /
# add this line to ignore all re-writes within the TEST folder.
RewriteRule ^test - [L,NC]
This will ignore all requests which contain the test/ directory. I would then suggest that you add a separate .htaccess file within your Zen base folder to handle any smart SEO mods etc from there, rather than cluttering your main .htaccess file if possible.
My wordpress site lies in a folder called /entwurf/cob1 and since I wanted it to be shown by simply typing in www.cob1.org I changed the permalink to cob1.org and now nothing works. I tried changing the htacces to:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /entwurf/cob1/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /entwurf/cob1/index.php [L]
</IfModule>
but this doesnt seem to work either. I want my files who lie in the entwurf/cob1/ folder to be shown when typing in the cob1.org website.
Currently nothing is seen.
Delete .htaccess, log into your wordpress, and let wordpress to generate .htaccess for you. ( Options -> Permanent Links -> Save)
Check is it working? No?
Upload to your web site root phpinfo file (php file with a content of "<?php phpinfo() ?>"), run it via browser.
Check what Server API cell says -> Apache? If yes Check is there mod_rewrite enabled? No? Ask Support to enable it.
If its not a Apache, ask for a help of the person who setup your server.
If you have access to the Worpdress admin panel go to
Setting > General
and make sure the Wordpress URL and Site URL are correct. They should be your new address. Change those and save it if you want to rewrite all the old URLS in the database.
If you don't have access to the WP admin panel try using this to manually make the changes to your database.
https://interconnectit.com/products/search-and-replace-for-wordpress-databases/
Delete .htaccess and regenerate it. Else use the following:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /entwurf/cob1/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
</IfModule>
Secondly, what you are trying to achieve has to be done in two steps.
1) In Settings > General, change the wordpress url in both fields to www.cob1.org
2) In your apache config, set www.cob1.org to point to /entwurf/cob1/
<VirtualHost *:80>
DocumentRoot "complete-absolute-path-to/entwurf/cob1/"
ServerName cob1.org
ServerAlias www.cob1.org
</VirtualHost>
3) Verify that .htaccess is being read. This takes a little bit of experimentation. Eg. I'd place some random text in .htaccess to force a server error on purpose. If I see the error, that means that the .htaccess file is being read. If it's not being read, make sure "AllowOverride All" is set in the apache config. .htaccess files are only read by apache (and apache family servers.)
Restart apache. You're done.
I have a site that is live on AWS - Wordpress, latest version, custom theme
It works fine in MAMP on my laptop, but on the live site, none of the pages besides the homepage work with the permalinks as /%post-name%/
I can make the permalinks work if I change them to default.
I don't think it has to do with htaccess, I've tried scrubbing it, we made some edits to it, and that has not made a difference.
Here are the contents of htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /ucampaign/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /ucampaign/index.php [L]
</IfModule>
I think it has to do with settings in the AWS instance, which I know can get complicated. But I wouldn't know where to look.
Thank you for looking at this, if there's more information needed to figure this out, I will be happy to provide :-)
Looks like a missing mod_rewrite. check apache config for that. Also, make sure Apache is reading the .htaccess file. When I say check to make sure the .htaccess is being read, does the server throw an error when you place junk inside the .htaccess file? What type of OS are you running on AWS?
I am new to Wordpress (and PHP). I am trying to make WP MVC's sample run on my wordpress:
http://wordpress.org/extend/plugins/wp-mvc/
I added the plugin and can see data listed in my events menu but when I click View, it tries to browse:
http://localhost/mysite/events/1
and it can't I get 404 error and I suspect it is most probably due the fact that Wordpress is not configured for pretty urls.
So I went in my admin site and under Settings/Permalinks I selected 2nd option of Day and name and I still get 404 error. Also on my home pages my posts disappeared and I get:
Apologies, but the page you requested could not be found. Perhaps searching will help.
Has anybody had any experience with WP MVC?
PHP is making my head hurt:(
I am not a PHP guy but can try going into your httpd.conf and see if your rewrite module is commented or not. If there is any # in front of it remove it and then restart wamp and try. I think this is mostly due to the fact that your module is not enabled. Let me know if it helped you.
Specifically this line:
LoadModule rewrite_module modules/mod_rewrite.so
Make sure there is no # in front of it.
When you set a permalink structure in Settings > Permalinks, WordPress attempts to write an .htaccess file to the root of your site, probably similar to this default:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
My file permissions are locked down a bit tighter than that, so I see the suggested contents at the bottom of the Permalink page, with some brief instructions. Are you seeing something similar? Did WordPress create an .htaccess file? Do you have mod_rewrite installed? (I don't recall if WordPress can autodetect mod_rewrite.)