non-wordpress files in wordpress installation directory - wordpress

I have installed wordpress in root directory. There is a file say test.html in same directory. I can not open this file www.mysiet.com/test.html with this url. When i open this file i get 'No posts found'.(I have coded wordpress's template on my own and this message is in index.php if no posts found). so my questions are:
How can i open an html file that is placed in root directory.
Can i create a new folder in root directory and install another wordpress site in that directory while root directory already have a wordpress installation.
Can i create a new folder in root directory (that already has wordpress installed in it) and place some files in that new directory and access them via my browser.
Thanks

Open your .htaccess in the root folder which once opened should look something 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`
Then add this above all of that and place your directory in designated spot "replace
with subdirectory name" you can add as many subs as you like
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/REPLACE WITH SUB DIRECTORY NAME/(.*)$ [OR]
RewriteCond %{REQUEST_URI} ^/REPLACE WITH SECOND SUBDIRECTORY NAME/(.*)$ [OR]
RewriteRule ^.*$ - [L]
</IfModule>`
Final Result should look like this if my subdirectory was named other
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/other/(.*)$ [OR]
RewriteRule ^.*$ - [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`

If I understand this you have wordpress installed on your server in its own folder, something like www/wordpress/. You also have a *.html file stored in www/test.html correct?
If I'm on track, then the issue is when you configured this you would have told it to use the wordpress directory. The best solution is to either move that file into the www/wordpress directory or into its own directory off that one, so you could have www/wordpress/test.html or www/wordpress/tests/test.html.
For question 2 I think what you are asking is can you do something like www/wordpress/ having a wordpress site, but then www/wordpress/wordpress2/ having another site. Though this is possible it isn't the best idea, why would you want to do this? You should have www/wordpress/ and www/wordpress2/. If the sites are connected in some way, you should look into wordpress mu, which is a multi site, which will allow you to run many sites all from the same installation.
Question 3 was answered above but yes you can do something like www/wordpress/tests/test.html.

You may need to change your .htaccess rules if you want to be able to access html files under your wordpress install.

You can check for File Permission.

Related

WordPress Broken Images

I don't know what can cause this problem, but my WordPress web-site after migrating to new server is not showing me images. It is maybe something in .htaccess file, rewrite rule or something. Any directions please?
Please click here to see my page.
.htaccess from public_html directory:
# 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 file from wp-content/uploads:
# BEGIN alti-watermark Plugin
<ifModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(.*(-([1-3][\d]{1,2}|[\d]{1,2})x300|-300x([1-3][\d]{1,2}|[\d]{1,2})|-([1-1][\d]{1,3}|[\d]{1,3})x1024|-1024x([1-1][\d]{1,3}|[\d]{1,3})|-940x446)\.jpg|.*(?<!-\dx\d)(?<!-\d\dx\d)(?<!-\dx\d\d)(?<!-\d\dx\d\d)(?<!-\d\d\dx\d\d)(?<!-\d\dx\d\d\d)(?<!-\d\d\dx\d\d\d)(?<!-\d\d\d\dx\d\d\d)(?<!-\d\d\d\dx\d\d)(?<!-\d\d\dx\d\d\d\d)(?<!-\d\d\d\dx\d\d\d\d)(?<!-\d\d\d\dx\d\d\d)(?<!-\d\d\d\dx\d\d)(?<!-\d\d\d\d\dx\d\d\d\d\d)\.jpg){1}((\?|\&)([^\.\?\ ]+))*$ ../plugins/alti-watermark/public/views/alti-watermark-public-bridge.php?imageRequested=$1 [PT]
</ifModule>
# [date=2016-12-27 18:06.57] [php=5.4.45] [width=300x300|1024x1024|940x446|fullsize] [plugin_name=alti-watermark] [version=0.3]
# END alti-watermark Plugin
Thanks in advance!
Usually that's because file paths are saved as absolute paths in the database.
In this case you either need to get some plugin that changes all those filepaths for you (see https://wordpress.org/plugins/search/migration/ for resources) or export your database as a mysql file, open it in an editor and do a search/replace to replace all old filepath instances with the new one, and then import that again in your database.

Can't access 2nd Wordpress instance in subdirectory

I've installed a second instance of wordpress in a subdirectory but when I try to access mysite.com/newsite I get a 404 error page on the root wordpress install page/theme. I've looked at the .htaccess files which have rewrite rules, tried adding an exception for the /newsite folder in the root .htaccess but it had no effect.
Can someone help with this?
Did you try this set of instructions? According to that site, the .htaccess in the second installation should look 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 . /newsite/index.php [L]
</IfModule>
# END WordPress
Try that out if you haven't and let me know if it works.

wordpress site ignoring sub directory when htaccess present

To begin I did not setup the website I am currently working on, and I am not very familiar with the wordpress setups. I have been called in on their site to add an admin section to this site which uses a Wordpress configuration. If I add a sub-directory, I can access the sub-dir via web just fine. The problem comes when I add a .htaccess to that subdirectory for Auth purposes. When I do this, and try to access the sub-directory, it errors to a 'Page Not Found'.
Can someone please help? I assume it is something with the Wordpress .htaccess file provided below:
# 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
UPDATE
When the .htaccess in the sub directory is blank, I can access the sub-directory via web just fine.
.htaccess (when filled out) in sub directory is below:
AuthType Basic
AuthName "Sphere"
AuthUserFile "/path/to/htpasswd"
require valid-user
I just tested a setup based off of your question. Here's an example of the hierarchy from what I could gather in your post:
public_html/ (all WP install files here)
public_html/admin/ (here I created a new folder similar to your question)
public_html/admin/index.php (test file - just echos a line of text)
public_html/admin/.htaccess (currently blank)
So my .htaccess within the new subdir that's spawned off of the WP root is blank. I'm not sure what kind of auth things would/should be in there. If I access "website/admin/" - the test line echos just fine. I don't see any 404s.
Could you maybe provide a little more detail so I can try to better replicate the issue you're seeing?
Found the solution for my problem elsewhere. Editing the root .htaccess (for wordpress) to match the one below should fix anyone who also encounters this issue:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/NameOf_Directory_ToAllow/(.*)$ [OR]
RewriteCond %{REQUEST_URI} ^/NameOf_AdditionalDirectory_ToAllow/(.*)$ [OR]
RewriteRule ^.*$ - [L]
</IfModule>
<IfModule mod_rewrite.c>
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

Wordpress inside Cakephp

I have installed Wordpress inside Cakephp's /app/webroot/blog/ folder and changed the wordpress permalink settings to Month and name (eg. http://abc.com/blog/2013/02/sample-post/).
Now when i am viewing a post i am getting Missing Controller(Error: BlogController could not be found).
I want to change the cakephp routes so that anything with /blog/* will point to webroot blog folder.
Can anybody help me on this?
When we change the permalink settings of Wordpress, it generates a .htaccess file, if there is required permission else we have to create it.
In the above case there was no .htaccess file inside /blog/ folder. I created it with the following mod_rewrite rules as provided by Wordpress while changing permalink settings.
<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>
After this every thing works fine.
There is no need to put the blog folder in webroot folder. You can access your folder by making slight changes in your .htaccess file. Just put your wordpress folder on root of cakephp with app folder and change .htaccess as given below.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule (blog/.*) $1 [L] # adjust the regex to what you want.
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
I tried both the above codes but none work for me.. then i found something by my own and it worked..So here it is ,, hope this will help some.
First Add the WordPress folder inside the webroot folder as blog. Inside blog paste the WordPress directories and files.. install the WordPress.. Now you will see in the WordPress admin general settings WordPress Address as http://cakephp/blog/app/webroot/blog, Change it to http://cakephp/blog. Save it ..
Now look for the .htaccess file in WordPress install root folder change RewriteBase and RewriteRule (last one ) to RewriteBase /blog/ and RewriteRule . /blog/index.php [L]
<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>

cloaking a folder to show root with wordpress pretty permalinks with htaccess

I installed wordpress in a subdirectory, lets say www.example.com/wordpress. I want the user to hit www.example.com and see the index of www.example.com/wordpress. I'm already using a custom pretty permalinks structure /%category%/%pagename%/ so the htaccess file is a little foreign to me.
My current htaccess file looks like this:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wordpress/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
</IfModule>
# END WordPress
AddType x-mapp-php5 .php
AddHandler x-mapp-php5 .php
I've tried numerous solutions from browsing across the web but nothing seems to work. I either get internal 500 errors or view previous pages in the root directory like example.com/about (even though I've deleted the original about.html in the root) even after I deleted my cache.
Any help you could give would be extremely helpful. Thanks for your time,
Rob
The .htaccess file needs to be located in / and not in /wordpress/ and RewriteBase should be / not /wordpress/. Leave the permalinks setup on, but don't use an .htaccess file in /wordpress/. You'll need to set the root directory in your wordpress install to / and setup redirects for /wordpress/wp-content/ and the other wordpress subdirs in /.htaccess so that requests to those directories are also forwarded correctly.
I assume that you want to set up wordpress this way because there are other directories not associated with the wordpress install that you want to be accessible from / (www.example.com/cgi-bin/ for example). You'll need to set up your .htaccess file in / to make any directory aliases (like /cgi-bin/) accessible so requests to /cgi-bin/ don't get redirected to wordpress.
EDIT:
I haven't done something like this in a long time, but here's my best guess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^wp-content/(.*)$ /wordpress/wp-content/$1 [L,QSA]
RewriteRule ^wp-admin/(.*)$ /wordpress/wp-admin/$1 [L,QSA]
RewriteRule ^wp-include/(.*)$ /wordpress/wp-include/$1 [L,QSA]
RewriteCond %{REQUEST_URI} !^/yourAliasUnrelatedToWordpress [NC,OR]
RewriteCond %{REQUEST_FILENAME} !-f [OR]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L,QSA]
</IfModule>

Resources