Page not found in wordpress - wordpress

i have installed the wordpress inside the domain with in a folder name, questions, landing page is working fine, no other links working, its say page not found. what to do ??
Using .htaccess like
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . questions/ [L]
Its running the index.php page only. any help ?

Looks like you'll need rewritebase as you have an htaccess on your parent folder
RewriteEngine On
RewriteBase /questions/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /questions/ [L]
Are you putting this on a subfolder of the root of the site called /questions?
if yes, I think you'll need to change
RewriteRule . questions/ [L]
to
RewriteRule . /questions/ [L]
or try this instead of rewritebase
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /questions/ [L]
</IfModule>

Related

index.php added in url with virtualhost on wordpress

I created a virtualhost with MAMP. It works well when I go to example.dev. I just installed a wordpress on example.dev without any problems. When I display a page or a post, there is a /index.php which is added before the page name. For example : example.dev/index.php/pagename.
I can not access example.dev/pagename, i have a 404 error.
In permalink's options, it generates automatically /index.php/%year%/%monthnum%/%day%/%postname%/.
I selected http://example.dev/example-article/ but it is still not working.
I have a htaccess at the root
RewriteEngine On
# 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
If somebody has an idea...
Thank you !!
To this url /index.php/%year%/%monthnum%/%day%/%postname%/ will work on Apache server add this rule to .htaccess file
RewriteRule ^index.php/(.*)/?$ /$1/ [L]
Above the WordPress rules:
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
Given that your .htaccess have the basic WordPress rules it would look like this:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php/(.*)/?$ /$1/ [L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
END WordPress

Accessing Codeigniter folder inside Wordpress directory

I have installed Codeigniter into a directory called /portal inside my Wordpress directory. If I visit www.mydomain.com/portal I can see my default controller/view, which is a login page, however if I try to login I get a 404 error in the console for www.mydomain.com/auth/login.
Here's my Wordpress .htaccess
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/portal [NC]
RewriteRule .* - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
And my Codeigniter main .htaccess file
<IfModule mod_rewrite.c>
RewriteEngine on
# Send request via index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
How do I get this to work?
Codeigniter 3, Wordpress 4.6.3, PHP 7.
You just need to add a question mark after the index.php like so:
RewriteRule ^(.*)$ index.php?/$1 [L]
So the full thing (in your CodeIgniter .htaccess file is like:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
1) wordpress .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>
2) Codeigniter .htaccess
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
3) And Changed in your config file i.e portal/application/config/config.php - $config['base_url']
$config['base_url'] = '/portal';
It's work for me, you will try this.

Override Wordpress Url Rewriting

I'm trying to override wordpress url rewriting for 1 specific file. My current wordpress install rewrites .html files to the according .php extension. So, for a permalink in MY wordpress installation might look like www.mysite.com/mypage.html.
I have an ACTUAL HTML file i want to show, however the htaccess keeps auto rewriting it by default, here is the code i'm trying to use to IGNORE this specific file
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/forex-system-demo\.html$ [NC] #<-- This is the file i want to ignore and run as a NORMAL .HTML file
RewriteRule . /index.php [L]
</IfModule>
I may have had some wierd browser caching going on because what is below now works after clearing cache.
Here is the SOLUTION:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^forex-system-demo.html$ - [L]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Here is the SOLUTION:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^forex-system-demo.html$ - [L] # <- this is where I tell wordpress to ignore this url
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

Unable to ignore a directory in WordPress install via .htaccess

/custom/player-registration.php
I've used the following .htaccess in my WordPress install and I can't access the above URL... any tips? I've tried 2 methods here... The URL continues to go to a WordPress search page.
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^custom - [L,NC]
RewriteCond %{REQUEST_URI} !^/(custom|custom/.*)$
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
UPDATE
I suppose I need to clarify that I am able to access /custom but am NOT able to access files within that directory... how do I access files within that directory?
Default WP .htaccess:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
means: if request doesn't point to any existing file or directory, use index.php
So it should serve Your file well with default settings. What are You trying to acomplish with the rest of Your file?
Try
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^custom.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

Wordpress - Permalinks and folders (.htaccess ?)

I have a Wordpress website with permalinks with post name. Now I have a new template on a specific page that uses files from exactly the same url path, and I can't change that.
How can I make Wordpress access my requested page (example.com/meniu/) and ignore the folder name with same name? (example.com/menu/swf/)
Thank you!
This is my .htaccess. How can I add exclusions?
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /club/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /club/index.php [L]
</IfModule>
You could prepend another rule to exclude only that directory:
RewriteCond %{REQUEST_URI} ^/menu
RewriteRule . /club/index.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /club/index.php [L]

Resources