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>
Related
I'am using wordpress as my blog in my laravel site. The wordpress blog are placed in subdirectories so that the domain of the wordpress is mydomain.com/blog.
I've tested it in my localhost and it works perfectly. But when i deployed it on server the site can show the homepage of my blog. But it can't display the blog's page ex. domain.com/blog/contact (404 Page not found) .
I've done several steps like changed the .htaccess and define the WP_HOME /WP_SITEURL but it still doesn't works to show my blog post .
Here is my wordpress .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>
And here are my laravel site's .htaccess
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/blog/ # <=== NEW LINE!!!!
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
what am i doing wrong here?
i have an issue with WordPress. The site working pretty normal but on the admin panel, various pages like edit post, installed plugins, add new plugin, add new page, settings redirects me to homepage. I'm googling like crazy for 3 days but i just found the mod_security issue. And it turned out useless for me too.
here is my .htaccess file
RewriteEngine On
RewriteBase /
RewriteCond /home/gokkur/public_html/wp-content/sitemaps%{REQUEST_URI} -f
RewriteRule \.xml(\.gz)?$ /wp-content/sitemaps%{REQUEST_URI} [L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
SecFilterEngine Off
SecFilterScanPOST Off
this is default content of WP .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
Maybe your custom rewrite rules generating problems.
I have an NGINX server that is proxy_pass-ing any urls that end in /blog to an IP address where I have a WordPress instance running with Apache.
The issue I am having is that when I enable permalinks I get a LimitInternalRecursion error. When I don't enable permalinks everything works as expected and I can access all of my blog pages through the proxy.
Here are the contents of the .htaccess file:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>
# END WordPress
EDIT:
I found out the rewrite rule provided by WordPress needed to be changed to:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ /index.php/$1 [L,QSA]
</IfModule>
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]
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>