Wordpress not redirecting properly (Forbidden) - wordpress

At some point I changed my Wordpress URL under Settings -> General. This created a lot of problems that are mostly fixed. However, my site's Url is "example.com/guiacentros/" and that works, but when users wrote "example.com" it also used to work, and now they get a "Forbidden - You don't have permission to access / on this server". Is this an error with the htacces file? This is the current htaccess file:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /guiacentros/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /guiacentros/index.php [L]
</IfModule>
# END WordPress
I'm a bit confused because there's a second htaccess file one level above, that looks like this:
# 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'm not sure why there's two, but I remember adding the second one fixed some issues.

Related

Can't Access wp-admin after hosting in new domain

I know that question asked many times before and I tried many of them but cant find solution.
this is my site url
http://www.primeproductionltd.com (most of things work fine)
http://www.primeproductionltd.com/wp-admin/
previousy It is on server - http://applanche.com/prime-production/wp-admin/
in have added in my wp.config
define('WP_HOME','primeproductionltd.com/');
define('WP_SITEURL','primeproductionltd.com/')
My Htaccess is
# 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
There is some cookie and rediret error shown.

404 error with a 2nd Wordpress install in a sub-directory

Lots of topics similar to this one but nothing seems to have worked so far. First time posting on this site - apologies if I miss off anything vital!!
Current site is - http://www.mansfordwebdesign.com - working fine but I want a 2nd Wordpress install as a development environment. I've created a subfolder called 'ilead' via my FTP and uploaded the Wordpress files.
When I go to http://www.mansfordwebdesign.com/ilead/wp-activate.php or any other related Wordpress file I get a 404 error.
Both sites have a .htaccess file - the first is -
`# 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 second is
`# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /subdirectory/
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /ilead/index.php [L]
</IfModule>
# END WordPress`
Is something wrong in these files or could it be anything to do with my WHM or CPanel controls??
Any thoughts or suggestions are appreciated.
Try changing the RewriteBase line to what is below for the subfolder..
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /ilead/
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /ilead/index.php [L]
</IfModule>
# END WordPress

Wordpress returns 404 on existing file

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]

Wordpress two sites in different folders - redirecting issue

I have two Wordpress websites, one is in root and another in subfolder.
example.com and example.com/newsite
When I open example.com/newsite/ all is working good, but if I open any pages likes
example.com/newsite/about or example.com/newsite/contact
browser auto redirect to
example.com/about and example.com/contact
I changed all paths, address, home url in config and sql to example.com/newsite/
Root htacess looks like:
# 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
htaccess for /newsite looks same.
Can anybody help me?
You should be using a different rewritebase if it's in a sub directory. Your wordpress rules in side htaccess under /newsite should look something like this.
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /newsite/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

Redirection Loop Error in Wordpress Website

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>

Resources