I have a very basic Wordpress install, with WP in root and permalinks on. For external directories I set up, things are working fine, no matter what's in them.
BUT, I recently replicated the site on a subdomain, to use as a dev site. That site has its own files, and its own database. On it, any php files in external directories are resulting in a WP-served 404 error. It serves html files within those directories just fine.
To recap:
mysite.com -- Wordpress site, all is fine
mysite.com/kitties/file.html --> html file outside of WP, fine.
mysite.com/kitties/file.php --> php file, outside WP, fine.
dev.mysite.com --> Wordpress site, all is fine
dev.mysite.com/kitties/file.html --> html file outside of WP, fine.
dev.mysite.com/kitties/file.php --> php file outside of WP, returns WP-served 404
My .htaccess file is below, and standard, but given that the problem is only on the dev site, I don't know that it has anything to do with htaccess, and wonder if it's an apache configuration issue?
# 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
When Moving / duplicating a site it is usually wise to resave the permalink settings, even when nothing changes.
Did you change the url in the settings of wp-config?
After that it is also wise to check the database for urls (tool).
Try those and see if the problem still exists.
Related
I'm attempting to migrate our wordpress blog from blog.ourdomain.co.uk to ourdomain.co.uk/journal, but ourdomain.co.uk/journal always shows the content from ourdomain.co.uk/.
To keep the migration simple, I started with a blank wordpress install in /journal, then imported 'All Content' using WP's built in export/import features.
All seemed well at first, but when I visit ourdomain.co.uk/journal it does not show a wordpress home page, but instead the home page of our main site. Even visiting ourdomain.co.uk/journal/index.php results in this behaviour. This site issues a 301 to redirect to ourdomain.co.uk/journal, and then I see the main site homepage rather than wordpress.
I can't see anything in the parent directory .htaccess file which would make this happen. The wordpress .htaccess file contains the code as per below, most of which was auto-created by wordpress, but I added the wp-admin redirect rule.
I can visit and use https://www.ourdomain.co.uk/journal/wp-admin/ no problem. Database cxn is OK. I can also visit static files such as https://www.ourdomain.co.uk/journal/readme.html. Links direct to posts also work fine, such as https://www.ourdomain.co.uk/journal/2021/post-title-here/ - it's just the homepage.
Even if I set the home page to be a static page, such as our about page in wordpress, this still happens.
I have defined define('WP_HOME', 'https://www.ourdomain.co.uk/journal'); and define('WP_SITEURL', 'https://www.ourdomain.co.uk/journal'); in wp-config.php
If I delete the contents of the /journal .htaccess file, then I am able to load https://www.ourdomain.co.uk/journal ONCE, then it goes wrong again because wordpress has rewritten the rewrite code to .htaccess - so clearly this is something to do with permalinks, but I'm unable to figure out what, exactly, the deal is.
Any help gratefully received.
Contents of .htaccess:
# 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 /journal/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /journal/index.php [L]
</IfModule>
# END WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^wp-admin\/?$ wp-admin/index.php [NC]
</IfModule>
OK, has worked for 24 hours now so: fixed by adding 'DirectoryIndex index.php' to .htaccess. Looks like redirection was just going up the folder tree until it found a directory index page it recognised, so making it recognise the one in /journal fixed it.
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.
I developed a website using CodeIgniter on a server, and I'm trying to migrate it to the production server but I'm getting a 404 error. Again, the website is working perfectly on the development server so all I did was copy the files and the database from one server to the other.
Here is the .htaccess file of the website folder (copied from the original installation):
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
</IfModule>
On the original server, the main URL was http://myowndomain.com/websitename/preview
Now it should be like http://www.websitename.com/preview
So yes, the website is in a subfolder in both cases, and the fies are exactly the same. I also checked the Apache configuration using "phpinfo()", and I can see that the "mod_rewrite" module is loaded.
The home page is working though ( http://www.websitename.com/preview ), it's able to run the index.php file, but all the links on the page don't work.
What am I missing?
Thanks
I am trying to copy down my web app from the internet to localhost on my machine for further development. The URL of my project is www.uniformlab.net. I am new to wordpress and this site is the biggest one that I have tried to copy.
I am using MAMP as my local server and have set up all the correct variables in getting the database set up. Some resources are loading and many are not, with a large download time.
This is a list of errors that are being thrown on runtime of the website. I don't think that these resources are being called from an absolute path.
I have set the home and siteurl settings in the DB to locahost:80/UNIFORMLAB
When I change the url to localhost/uniformlab/wp-admin, I am getting thrown ERR_TOO_MANY_REDIRECTS by the browser.
I have checked my htaccess file and it seems normal. This is what I have:
# 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
Any help would be appreciated.
There is not too much info, but one thing is that the home and siteurl in WordPress have to be the full path to the WordPress directory.
You said that your URL is http://localhost/uniformlab but you changed the setting to localhost
Update again the home and siteurl to http://localhost/uniformlab
Completely new to Wordpress and I am working on a collaborative project however I am having trouble getting up and running.
This is what I have done so far...
Installed MAMP.
Went to PHPmyadmin and created a database (e.g. myblog).
Downloaded Wordpress.
Copied and pasted existing wp-content into my downloaded Wordpress folder in htdocs and also renamed that folder from 'wordpress' to '/myblog'.
Went to localhost selected /myblog.
Installed Wordpress
Went to dashboard click visit site.
Now getting Not Found
The requested URL /myblog/lessons/orientation/ was not found on this server.
Would anyone know what I am doing wrong here?
You need to add the htaccess rewrite rules for WordPress to your MAMP server. Without these rewrite rules, the browser request doesn't actually get routed to be handled by WordPress.
# 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
In MAMP, you have to add these rules in the MAMP app itself and not in an .htaccess file (unless you specifically configure MAMP to allow that).
Here is a screenshot of where to do that in MAMP 2, the field is called "Customized Virtual Host Directory Settings"
Dashboard>Settings>Permalinks try changing your permalink setting.