Okay. So I have a site that needs to be live around 8am EST. Everything was going fine, but when I uploaded it to the server my two pages return 404 not found errors. Absolutely everything else on the site is fine.
I have tried several things. I have reset the permalinks several times. I have deleted auto-saved files in the database. I have re-uploaded the database. I have re-uploaded the site. I have set the permission on .htaccess. I have deleted .htaccess and let it rewrite itself. Nothing has worked. Does anyone have any ideas?
The page works when it is set to default, but NOT when it is set to anything else.
Update 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
Based on the .htaccess you can make these changes... although this is the default .htaccess for Wordpress it looks like it has an extra slash in front of index.php for the main redirect line. You'll also want to check to make sure that your Virtual Host Apache directory contains AllowOverride All.
In this example we're telling Apache if the request isn't for index.php then see if it's a real file and a real directory, then if it's not show them the default page. This is similar to the default behavior of Wordpress already.
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !=index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.* index.php [L]
</IfModule>
# END WordPress
There is also a whole Stack Exchange site devoted to Wordpress at wordpress.stackexchange.com.
This is basically the same question:
https://wordpress.stackexchange.com/questions/11149/htaccess-disable-wordpress-rewrite-rules-for-folder-and-its-contents
Related
To begin I did not setup the website I am currently working on, and I am not very familiar with the wordpress setups. I have been called in on their site to add an admin section to this site which uses a Wordpress configuration. If I add a sub-directory, I can access the sub-dir via web just fine. The problem comes when I add a .htaccess to that subdirectory for Auth purposes. When I do this, and try to access the sub-directory, it errors to a 'Page Not Found'.
Can someone please help? I assume it is something with the Wordpress .htaccess file provided below:
# 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
UPDATE
When the .htaccess in the sub directory is blank, I can access the sub-directory via web just fine.
.htaccess (when filled out) in sub directory is below:
AuthType Basic
AuthName "Sphere"
AuthUserFile "/path/to/htpasswd"
require valid-user
I just tested a setup based off of your question. Here's an example of the hierarchy from what I could gather in your post:
public_html/ (all WP install files here)
public_html/admin/ (here I created a new folder similar to your question)
public_html/admin/index.php (test file - just echos a line of text)
public_html/admin/.htaccess (currently blank)
So my .htaccess within the new subdir that's spawned off of the WP root is blank. I'm not sure what kind of auth things would/should be in there. If I access "website/admin/" - the test line echos just fine. I don't see any 404s.
Could you maybe provide a little more detail so I can try to better replicate the issue you're seeing?
Found the solution for my problem elsewhere. Editing the root .htaccess (for wordpress) to match the one below should fix anyone who also encounters this issue:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/NameOf_Directory_ToAllow/(.*)$ [OR]
RewriteCond %{REQUEST_URI} ^/NameOf_AdditionalDirectory_ToAllow/(.*)$ [OR]
RewriteRule ^.*$ - [L]
</IfModule>
<IfModule mod_rewrite.c>
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
On a site I'm working on the main portion of the site is wordpress powered.
I've added another directory completely separate from the wordpress site called employees and I'm having a little issue with the mod_rewrites for the new directory.
obviously wordpress uses this code to make its pretty urls
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php
</IfModule>
# END WordPress
but I want to add this rule as well and any other necessary rules or conditions so that all of the /name.php files in the employees directory get redirected to just /name
RewriteRule ^employees/(.*)$ employees/$1.php [L,QSA]
The several things I've tried all just cause employees/main to 404 but employees/main.php resolves properly.
Hello guys what can be the reason for this:
I have a folder "wallpapers" not related to my website (Wordpress) in the same web hosting and images inside. If i wanted to access them I would go to website.com/wallpapers/myimage.jpg and it worked!
But I noticed it doesn't work anymore now I see my wordpress site + error 404 inside the website.
I have tried to fix this disabled few plugins etc... but where should I look? What can be the reason? Maybe the htaccess?
Thanks!
Yes, I think your guess on the .htaccess is perfectly correct. If you enable permalinks in Wordpress it automatically creates, or tries to create (depending on permissions) the following .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
The two lines in this that are relevant to you are;
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
What they are basically doing is making sure that every url request gets run through the index.php in the root except any files or directories that actually exist as separate files and directories outwith the Wordpress install (ie your wallpapers directory). So first of all I would make sure that your .htaccess looks like this.
I needed to do the same in the past, and it drove me nuts so if that can help here's what I've done. I had the default .htaccess wordpress created in my wordpress folder when activating the permalinks option, the folloowing :
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
for some reason...
I could access http://example.com/phpinfo.php fine,
but http://example.com/myfolder was returning a 404, despite (if I'm correct) the line RewriteCond %{REQUEST_FILENAME} !-d should allow me to show what was into that folder as it's existing and having the correct permissions (user:user chmoded 755)
after having tried everything I could find on the subject, I ended up creating a .htaccess into my folder "/myfolder"
with the unique following line in it :
Options +Indexes
And I finally got http://example.com/myfolder to answer the response 200 OK
I suppose this is not the best ever solution but it's the only one that worked for me and as I just need this to work for one or two folders, it did not need to be more adaptive / flexible
I installed wordpress in a subdirectory, lets say www.example.com/wordpress. I want the user to hit www.example.com and see the index of www.example.com/wordpress. I'm already using a custom pretty permalinks structure /%category%/%pagename%/ so the htaccess file is a little foreign to me.
My current htaccess file looks like this:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wordpress/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
</IfModule>
# END WordPress
AddType x-mapp-php5 .php
AddHandler x-mapp-php5 .php
I've tried numerous solutions from browsing across the web but nothing seems to work. I either get internal 500 errors or view previous pages in the root directory like example.com/about (even though I've deleted the original about.html in the root) even after I deleted my cache.
Any help you could give would be extremely helpful. Thanks for your time,
Rob
The .htaccess file needs to be located in / and not in /wordpress/ and RewriteBase should be / not /wordpress/. Leave the permalinks setup on, but don't use an .htaccess file in /wordpress/. You'll need to set the root directory in your wordpress install to / and setup redirects for /wordpress/wp-content/ and the other wordpress subdirs in /.htaccess so that requests to those directories are also forwarded correctly.
I assume that you want to set up wordpress this way because there are other directories not associated with the wordpress install that you want to be accessible from / (www.example.com/cgi-bin/ for example). You'll need to set up your .htaccess file in / to make any directory aliases (like /cgi-bin/) accessible so requests to /cgi-bin/ don't get redirected to wordpress.
EDIT:
I haven't done something like this in a long time, but here's my best guess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^wp-content/(.*)$ /wordpress/wp-content/$1 [L,QSA]
RewriteRule ^wp-admin/(.*)$ /wordpress/wp-admin/$1 [L,QSA]
RewriteRule ^wp-include/(.*)$ /wordpress/wp-include/$1 [L,QSA]
RewriteCond %{REQUEST_URI} !^/yourAliasUnrelatedToWordpress [NC,OR]
RewriteCond %{REQUEST_FILENAME} !-f [OR]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L,QSA]
</IfModule>
We have a WP install in the root of our server and its running great.. but, we just installed another app in a subdomain. Now, I can view the index.php of that app but cannot do anything with it.. the htaccess rules in the root (from WP base install) are effecting the requests.
So, how to I eliminate the WP htaccess file from effecting the subdomain?
Here is the htaccess contents for the root (WP install):
<IfModule mod_rewrite.c>
RewriteEngine On
# BEGIN WordPress
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
</IfModule>
And for the htaccess in the subdomain:
RewriteEngine on
RewriteCond $1 !^(index\.php|css|stylesheets|js|images|user_guide|favicon\.ico|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
I've search everywhere online and tried a couple samples I found.. nothing has worked.
Any help is greatly appreciated !
Thanks
UPDATE:
It seems that maybe Wordpress is not the culprit.. out of curiosity, I removed all lines in the WP .htaccess file.. and the app in the subdomain was still not working. Its rewrite rule must be wrong..
So, it is the second rewrite rule that is not working. If I type in /index.php?about then I can see the about page.. but it should display by going to: /about
WP is also the culprit (you have two problems).
I can fix the first .htaccess problem because WP is predictable. You want to put this before the BEGIN WordPress section:
RewriteRule ^subdir-name/.*$ - [PT]
That grabs any requests to your subdir and Passes it Through (PT) so that it is not hijacked by WordPress.
The problem in your second .htaccess is that it seems to be assuming it is still in the root directory. For this one, I can't be sure without seeing the layout of your app, but the / before index.php may well be wrong. Are you sure that the paths in the second file match the new layout of your files?
Um... should this work? For sub-directory "office" - cheers :-)
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^office/.*$ - [PT]
# BEGIN WordPress
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
</IfModule>