Current time: 04-20-2014, 04:33 PM Hello There, Guest! (LoginRegister)

Can I have Wordpress in a WP directory, but my blog's main page in root?
10-10-2011, 03:20 PM (This post was last modified: 10-10-2011 03:21 PM by jalpuna.)
Post: #1
Can I have Wordpress in a WP directory, but my blog's main page in root?
I'm finding the wordpress documentation to be wildly inaccurate and I'm hoping for help with something that should be super easy.

I did a 1-Click install and now have wordpress 3.2.1 in a directory named WP

I want my home page, generated by wordpress, to be in the site root. In other words:

Wordpress is here:
http://mydomain.com/WP/

I want my home page to be here:
http://mydomain.com/index.php

Obviously, those are fake links since the site has no content yet other than the wordpress sample page.
I've followed the directions wordpress gave me, here. Lots of that info seems wrong. They're talking about an htaccess file that doesn't exist, and they tell me to change a require line in index.php that isn't in index.php. What the heck?

This seems like it should be so simple. How do I get my main index page to sit one level outside of the WP directory (in other words, in my site's root?
Visit this user's website Find all posts by this user
10-10-2011, 05:09 PM
Post: #2
RE: Can I have Wordpress in a WP directory, but my blog's main page in root?
It’s not so simple, but it can be fixed. The *best* thing to do would be to reinstall WordPress in root, so you leave that directory text box blank. The second best thing to do would be to move all your WordPress files to root, then log into wp-admin and change the URL for your site.

Anything else you’d do would be a kludge and give you headaches later.

-Scott
Find all posts by this user
10-10-2011, 05:40 PM
Post: #3
RE: Can I have Wordpress in a WP directory, but my blog's main page in root?
(10-10-2011 05:09 PM)sdayman Wrote:  It’s not so simple, but it can be fixed. The *best* thing to do would be to reinstall WordPress in root, so you leave that directory text box blank. The second best thing to do would be to move all your WordPress files to root, then log into wp-admin and change the URL for your site.

Anything else you’d do would be a kludge and give you headaches later.

Wow. You're really saying that the best wordpress can do is dump all of that junk (over 20 files and folders) into the home directory? Is that realy the only way to have my home page be where my home page is supposed to be? Yikes. So much for organization.

Jalpuna! - personal blog
twenty200 - photo blog
robsdemo - what I do
Visit this user's website Find all posts by this user
10-10-2011, 06:06 PM
Post: #4
RE: Can I have Wordpress in a WP directory, but my blog's main page in root?
Are you planning on installing anything other than WordPress, or are you using WP for the whole thing? For instance, can you quickly map out what the URLs on your site will look like, and what will handle each of them?

For what it's worth, if you plan on installing software other than WordPress on the site, you're best off keeping all WordPress-related URLs localized to the directory that WP is installed to. It is possible to have WP handle URLs outside its own directory, but it's messy and I wouldn't recommend it.
Find all posts by this user
10-10-2011, 06:09 PM
Post: #5
RE: Can I have Wordpress in a WP directory, but my blog's main page in root?
It's a new domain, so who knows what it will evolve with over time. It seems ridiculous to have my home page have to be inside a directory, but I don't want all of that wordpress stuff at root.

I use movable type in other sites. Placing the home page outside of the MT directory is as simple as setting it in preferences. I see that preference option in wordpress/settings, but changing it doesn't work (it serves up errors, and as I said, the wordpress documentation on that feature is a mess)

Jalpuna! - personal blog
twenty200 - photo blog
robsdemo - what I do
Visit this user's website Find all posts by this user
10-10-2011, 07:12 PM (This post was last modified: 10-10-2011 07:13 PM by Ryo-ohki.)
Post: #6
RE: Can I have Wordpress in a WP directory, but my blog's main page in root?
Here is what you do and its pretty simple. I basically followed the instructions on the codex for using a pre-existing subdirectory install BUT you are right about the one-click not generating an .htaccess file so I found the following which should be fine for you. You can remove any of the parts from the .htaccess that you don't find useful. Obviously you need to change the yourwebsite stuff to the actual url of your website.

Anyway first install wp to your sub-directory which i did to androidxtreme.com/wp and add the .htaccess file there. Then go to your wp-admin and to settings/general and change the site address (url) to yourwebsite.com (so i changed it to androidxtreme.com in my case --NOT THE WORDPRESS ADDRESS (URL) V IMPORTANT-- and save. Finally copy the index.php (You must change that line in step 6 on the codex like it said first!) and the .htaccess file to your root website.com directory. Then everything should be working as you can see http://androidxtreme.com looks fine and only the altered index.php file and the .htaccess file are actually in the directory Smile

Code:
# protect the htaccess file
<files .htaccess>
order allow,deny
deny from all
</files>

# disable the server signature
ServerSignature Off

# limit file uploads to 10mb
LimitRequestBody 10240000

# protect wpconfig.php
<files wp-config.php>
order allow,deny
deny from all
</files>

#who has access who doesnt
order allow,deny
#deny from 000.000.000.000
allow from all

#custom error docs
ErrorDocument 404 /notfound.php
ErrorDocument 403 /forbidden.php
ErrorDocument 500 /error.php

# disable directory browsing
Options All -Indexes

#block referring domains
RewriteEngine on
RewriteCond %{HTTP_REFERER} digg\.com [NC]
RewriteRule .* – [F]

#disable hotlinking of images with forbidden or custom image option
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?yourdomain.com/.*$ [NC]
#RewriteRule \.(gif|jpg)$ – [F]
#RewriteRule \.(gif|jpg)$ http://www.yourdomain.com/stealingisbad.gif [R,L]

# php compression – use with caution
<ifmodule mod_php4.c>
php_value zlib.output_compression 16386
</ifmodule>

# set the canonical url
RewriteEngine On
RewriteCond %{HTTP_HOST} ^yourwebsite\.com$ [NC]
RewriteRule ^(.*)$ http://www.yourwebsite.com/$1 [R=301,L]

# protect from spam comments
RewriteEngine On
RewriteCond %{REQUEST_METHOD} POST
RewriteCond %{REQUEST_URI} .wp-comments-post\.php*
RewriteCond %{HTTP_REFERER} !.*yourwebsite.com.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^$
RewriteRule (.*) ^http://%{REMOTE_ADDR}/$ [R=301,L]
# BEGIN WordPress

# END WordPress

http://www.marciesgifts.com
PM for manual CMS(drupal,joomla,etc)/Blog(WP,MT,etc
)/forum(phpbb,smf,etc) install/transfer $75.
$25 Off w/promo code SPRINKLES
Visit this user's website Find all posts by this user
10-10-2011, 07:21 PM
Post: #7
RE: Can I have Wordpress in a WP directory, but my blog's main page in root?
(10-10-2011 07:12 PM)Ryo-ohki Wrote:  only the altered index.php file and the .htaccess file are actually in the directory Smile

Hey now! That's exactly what I want.

Two things:

#1 - Just to clarify, this leaves everything INSIDE the wordpress directory except index.php and .htaccess. Those two would reside in my site root. Right?

#2 - Is there any danger in doing this? Any issues I might not think of?
Visit this user's website Find all posts by this user
10-10-2011, 07:24 PM
Post: #8
RE: Can I have Wordpress in a WP directory, but my blog's main page in root?
(10-10-2011 07:21 PM)jalpuna Wrote:  #1 - Just to clarify, this leaves everything INSIDE the wordpress directory except index.php and .htaccess. Those two would reside in my site root. Right?

correct and be sure to COPY the index.php and.htaccess file and NOT MOVE. The files need to be in both places.

Quote:#2 - Is there any danger in doing this? Any issues I might not think of?

Nope, this took me not even 5 minutes. Just note that as your install is actually residing in a sub-directory you will still access the wp-admin in yoursite.com/subdirectory/wp-admin instead of just yoursite.com/wp-admin.

http://www.marciesgifts.com
PM for manual CMS(drupal,joomla,etc)/Blog(WP,MT,etc
)/forum(phpbb,smf,etc) install/transfer $75.
$25 Off w/promo code SPRINKLES
Visit this user's website Find all posts by this user
10-10-2011, 07:50 PM (This post was last modified: 10-10-2011 08:12 PM by jalpuna.)
Post: #9
RE: Can I have Wordpress in a WP directory, but my blog's main page in root?
Awesome! That's exactly what I want. I just set it up and it looks like it works. SWEET.

Quick question: Do I need any htaccess info in my site root specifically for Wordpress? Obviously, I need the htaccess file inside the wordpress directory. Thanks for the one you posted, by the way! Seems to work like a charm. ...do I need anything wordpress specific in my site root htaccess?
Ryo - I just want to say thanks again. You were a big help. Much appreciated! I'm a long time movable type guy who is in the very beginning of teaching myself wordpress.

Jalpuna! - personal blog
twenty200 - photo blog
robsdemo - what I do
Visit this user's website Find all posts by this user
10-10-2011, 08:34 PM
Post: #10
RE: Can I have Wordpress in a WP directory, but my blog's main page in root?
the information i found was posted from someone who wanted to have as much secure .htaccess file specifically for wordpress as possible so you can keep it as is and be good to go.

http://www.marciesgifts.com
PM for manual CMS(drupal,joomla,etc)/Blog(WP,MT,etc
)/forum(phpbb,smf,etc) install/transfer $75.
$25 Off w/promo code SPRINKLES
Visit this user's website Find all posts by this user


Forum Jump: