I have installed and configured on apache server wordpress (I didn't do that, I am not expert on websites). Now I uploaded my php application so root structure looks like this:
...
images
voucher (this is my application)
wp-admin
wp-content
wp-includes
When I input http://address.com/voucher/index.php into browser I got Wordpress error which contains information "Oops! That page can’t be found.". I don't know why is it trying to achieve my voucher catalog "by Wordpress system", maybe should I set some settings (.htacces or smth like this)?
Wordpress when installed uses rewrite to redirect all requests to index.php by default. If you have other dirs or files on the server you will have to consider them in your .htaccess rules.
Modify your .htaccess. Here is a sample rules that bypasses wordpress rules for your voucher directory.
#only allow the wordpress rules if it is not request /voucher.
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_URI} !^/voucher [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Or you can do your rules this way.
#if the request is for the voucher folder, do nothing and display the page
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/voucher [NC]
RewriteRule ^ - [L]
# BEGIN WordPress
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
</IfModule>
Related
i have a wordpress website
i have uploaded some of my php code at the root of my web where wordpress is installed.
i want to open those page directly.
they open if # www.example.com/newcode.php
but i want to open them like www.example.com/newcode (without extension .php)
the problem is when i put some .htacess code to achieve this, all wordpress pages stops and shows error404 not found and if i remove htaccess code then i cant open my own newcode.php page without extension
i tried to put this code in htaccess
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ([^\.]+)$ $1.php [NC,L]
but doesnt work...
this is my wordpress .htaccess (automatically created by wordpress)
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ([^\.]+)$ $1.php [NC,L]
</IfModule>
# 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
id have more files like newcode.php and some folder in which there are more code files and i want all of them to open like this
i want both wordpress pages as well as my new code page to open without any extension and i cant put newcode.php in seperate folder and make another htaccess for that specific folder
This is documented pretty clearly - especially in this case where you don't even need any regexp knowledge. Simply replace everything before # BEGIN WordPress with:
RewriteEngine On
RewriteRule /newcode /newcode.php [L]
I have installed WP at my root directory and moved the CI application that was at the root to a sub-folder called "members." The WP pages are working just fine, but when I try to sign into the CI application, using my log in form on a WP page, I'm getting back a 404 error. I have a feeling this has something to do with routing and WP overriding things but I've been unable to figure this out so far.
.htaccess at root:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/(info|info/.*)$
RewriteCond %{REQUEST_URI} !^/(members|members/.*)$
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
I wanted the info and members controllers in CI to still be accessible from WP.
I can tell the CI page is being hit because I can still redirect the browser by adding a line in the controller, yet when I try to actually post data with the form and look at the Network activity in Chrome, I can see the 404 is coming back on the page I'm posting to.
UPDATE:
Okay, I've been able to isolate this to being a routing issue, the problem is Wordpress is functional, but CodeIgniter isn't. I realize there's no modrewrite rules that apply to the /members/ directory. Here's where I'm at:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/(members|members/.*)$
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /members
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
Any thoughts?
It was a routing issue! I didn't realize I needed to put the Codeigniter specific .htaccess entries at the subfolder where the Codeigniter application resided. Of course it was that simple!
I have a Wordpress website with root located at
http://www.example.com/web
Via htaccess, when I visit that address I would like to see what's on http://www.example.com/web/about-me with the browser still displaying http://www.example.com/web.
Is it possible to achieve this via .htaccess? What I have right now is
BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /web/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /web/index.php [L]
</IfModule>
END WordPress
I tried adding at the bottom
RedirectMatch ^/$ /about-me/
Without any success.
So essentially you have a website which is hosted on a sub-directory of your domain, and you want to rewrite the homepage URL to your about-me page, but without the user seeing the URL change. Your main issue is trying to use a Redirect which will change the displayed URL.
This should do it
RewriteBase /web # Dropped the / suffix otherwise the rewrites get //
## RewriteRule ^index\.php$ - [L] - # Removed because the Conditions below should be doing this?
RewriteRule ^$ /about-me [L] # Redirect homepage
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L] # dropped the /web prefix as that is managed by the RewriteBase
Results:
I encountered a strange behaviour with WordPress website.
I have created /en folder in the root and want to have another WordPress website there.
The problems appears when I try to open mainwebsite.com/en I'm being redirected to mainwebsite.com/english-post
So, WP gives the priority to the post that is found in the main domain and it's slug begins with "en".
I tried changing the folders name to "ren" and the website in the folder than shows up nicely.
I've checked .htaccess file for some redirects and none is set.
I noticed that this is a typical WP behaviour, as I tested on some "bigger" brands that use WP and same thing happens,ie:
https://www.smashingmagazine.com/en redirects to --> https://www.smashingmagazine.com/2014/11/enabling-multiscreen-tracking-with-google-analytics/
http://vanheusen.com/en redirects to --> http://vanheusen.com/products/english_shaded_box_silk_tie/
Have any idea how to solve this?
This is my .htaccess file:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(en/)
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Try using this rule in your main .htaccess
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteRule ^index\.php - [L]
RewriteCond %{REQUEST_URI} !^/en
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
And then you need this rule below in the .htaccess inside en folder
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /en/
RewriteRule ^index\.php - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /en/index.php [L]
</IfModule>
# END WordPress
Let me know how this works
I have a wordpress installation in my root, here is the .htaccess for it:
I have a directory called /websites in which developers have FTP access to work on client wordpress installations
In this directory could be any number of other wordpress installs such as /company1 /company2 etc.
So the urls for these nested installs would be /wwwroot/websites/company1/ and so forth.
The issue is that while wordpress will let me install into any first level subdirectory from the root, the second nesting breaks the .htaccess.
How can I setup my .htaccess so that when a drop a new site into /wwwroot/websites/base/ it will work as intended?
EDIT: I have tried this suggestion from vico but still get a 404 error in /wwwroot/websites/base/ Here are the exact copies of the files:
/wwwroot/.htaccess:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
</IfModule>
# END WordPress
/wwwroot/websites/.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>
# END WordPress
/wwwroot/websites/base/.htaccess:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /base/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /base/index.php [L]
</IfModule>
# END WordPress
Thanks!
Sorry previous answer was intended for something else.
To install wordpresses in the 2nd Level just remove all first level files and htaccess files
/wwwroot/content/
-/subdir1/
----wordpress file and htaccess here
-/subdir2/
----wordpress file and htaccess here
-/subdir3/
----wordpress file and htaccess here
I think wordpress will take-care of everything if you just move a fresh copy into each directories and run the wordpress setup on each