I have the following stucture:
Wordpress installed in root, and an /api/api.php file manually created
When I go to www.example.com/api/api.php I get a 404
This is my .htaccess in the root folder:
Options +FollowSymLinks
RewriteRule ^api/api\.php$ - [L]
# 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 expect this should have let requests to /api/api.php through unmolested.
Also, I tried putting in a .htaccess file in /api with just
# disable the rewrite engine
RewriteEngine off
but I am still getting a 404 error despite this.
The rest of the site works fine, and I have tried disabling all WP plugins just in case.
try change your permalink from admin panel or if you have an IIS7 server then your permalink should be like %postname%index.php.
and also try this .htaccess code and instead of 'example' write your site base path name
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /example/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /example/index.php [L]
Related
Just noticed that the site was showing an internal server error and when checking the .htaccess file found that this was in it around 50 times!
Why would wordpress be creating this rule over and over and over again in .htaccess?
# 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>
This is the URL http://tinyurl.com/qybjyoq
Your Site is not giving any internal server error.
And wordpress .htaccess file is writing the code only one time
My settings for permalinks: default : /?p=123 works but if I switch to by post name All pages stop working and just go to a 404
Check your permalink settings and see if you have enable rewriting in your .htaccess
# 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>
I am using GoDaddy Delux Hosting, Linux server. I have a wordpress installation in the root directory. I've started a development directory under the root directory. I don't have a wordpress installation under the development directory, but my own project.
My objective is to circumvent wordpress url rewriting just for the development directory, and redirect every url that starts with the development directory to development/index.php. I have experimented with numerous mod_rewrite combinations, but I couldn't get it work. I get the standard wordpress "page not found" page for everything except mysite.com/development/index.php
The last configuration I've come up with is the following:
root directory .htaccess file:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/(development|development/.*)$
RewriteRule . /index.php [L]
</IfModule>
development directory .htaccess file:
RewriteEngine On
RewriteRule .* index.php [L]
Any ideas how to best approach this?
PS: I haven't used "development" in Wordpress as a slug.
In the main .htaccess file you should ignore anything under "development" - you don't need the initial forward slash because of RewriteBase / and you can make the trailing slash optional with a ?, and there is no need for .*$.
In the subdirectory you ignore anything not in the subdirectory for rewrites using RewriteBase /development/ sending everything to /development/index.php where the request is not a file or directory.
Give the following a try:
/.htaccess
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^development/?
RewriteRule . /index.php [L]
</IfModule>
/development/.htaccess
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /development/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /development/index.php [L]
</IfModule>
I have switched to a new website design (to wordpress from static),so in-order to map old pages to new pages i edited the htacess file,But it resulted in a redirection loop and the site was down after days.So i removed the htacess file.How am i supposed to do proper redirection.
Here are the Redirection code contents from the htacess
# 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
Redirect /test1.htm http://www.mysite.com/test1
Redirect /test2.htm http://www.mysite.com/test2
Redirect is a command from a different module than RewriteRule is. This will cause problems quite often.
Just do the redirect using RewriteRule.
#just in case test.html still exists in the filesystem
Options -MultiViews
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^test1\.htm /test1 [L,R=302]
RewriteRule ^test2\.htm /test2 [L,R=302]
# BEGIN WordPress
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
</IfModule>
I have a wordpress hosting site www.mysite.com/myBlog . The wordpress installation is done inside public_html/www/myBlog folder inside my host folder.
I also have a folder public_html/www/myName which redirects me to a domain myName.com
Although this works fine but inside myName folder i have files like index.html. acad.html, worexp.html
clicking on them i expect a behavior like
myName.com/index.html
myName.com/acad.html
myName.com/workex.html
though i get it as myname.com only.
I found htaccess rules in myName folder as :
Redirect http://mydomainName.com/myName/+
# 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
RewriteCond %{HTTP_HOST} ^mydomainName.com$
RewriteRule ^/?$ "http\:\/\/www\.mydomainName\.com\/myBlog" [R=301,L]
Can anyone help me with whats wrong with the htaccess file ?
More details:
My WordPress blog has something messed up. I can go to my blog and homepage works fine but when i try to go to any post it throws an 403 error. Apache forbidden.
Tried talking to web host for permissions its ok.
checked htaccess. Replaced code by default code stil not working.
Removed permalinks to default deleted htaccess created new permalinks.
Gave permissions to all the files in blog directory
Rewrote robots.txt Blog url is : www.windowsvj.com
Wordpress community is not able to suggest something very helpful too.
Current Redirect rule code in .htaccess is :
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wpblog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wpblog/index.php [L]
</IfModule>
# END WordPress
This could be the result of FollowSymLinks being disabled in the server configuration. Simply adding Options +FollowSymlinks to the .htaccess file could do the trick.
Instead of using the flag [L]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wpblog/
RewriteRule ^index\.php$ - [L] <---
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wpblog/index.php [L] <---
</IfModule>
# END WordPress
Try using [QSA]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wpblog/
RewriteRule ^index\.php$ - [QSA] <---
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wpblog/index.php [QSA] <---
</IfModule>
# END WordPress
How [L] works is if the RewriteRule matches
RewriteRule . /wpblog/index.php [L]
Then all other rewrites after this RewriteRule are ignored as stated on the Apache website
"In most contexts, this means that if the rule matches, no further rules will be processed." http://httpd.apache.org/docs/current/rewrite/flags.html
Here is a link with more information on .htaccess flags
http://httpd.apache.org/docs/current/rewrite/flags.html
Hope this works for you :P