Putting my main page in a sub-folder?

Status
Not open for further replies.

aliasneo

New Member
Messages
71
Reaction score
0
Points
0
I have created a sub-domain of my site.

Main domain is elaosta.com and a sub-domain hamid.elaosta.com.

hamid.elaosta.com is a subdomain with it's own sub-directory as its root. I then created a folder inside it's root "wordpress".

What I want is for the URL hamid.elaosta.com take me straight into that "wordpress" sub-dir without adding "wordpress" to the end of the domain as it currently does with my redirect (permenant).

Any ideas please?
 

DeadBattery

Community Support Team
Community Support
Messages
4,018
Reaction score
120
Points
0
You could just go into cPanel's file manager and move all the files in ~/public_html/wordpress/ to ~/public_html/
(one directory above)
 

aliasneo

New Member
Messages
71
Reaction score
0
Points
0
You could just go into cPanel's file manager and move all the files in ~/public_html/wordpress/ to ~/public_html/
(one directory above)

Yeh, I know, but I wanted to keep it in a sub-dir to be tidy, because I plan to add a forum in there later too which wants a directory of its own.
 

shant93

Member
Messages
119
Reaction score
0
Points
16
You can try using .htaccess files. To figure out how to use such a file, google " .htaccess " and it should be pretty easy from that point on.

You'd have something like
HTML:
DirectoryIndex wordpress/index.html

Don't overuse .htaccess files, they are not efficient. Also, I am not sure if you are even allowed on x10, I forgot to check, but if you are, that is the solution you are looking for.
 

aliasneo

New Member
Messages
71
Reaction score
0
Points
0
You can try using .htaccess files. To figure out how to use such a file, google " .htaccess " and it should be pretty easy from that point on.

You'd have something like
HTML:
DirectoryIndex wordpress/index.html

Don't overuse .htaccess files, they are not efficient. Also, I am not sure if you are even allowed on x10, I forgot to check, but if you are, that is the solution you are looking for.

I guess it is allowed becuse the cPanel automatically created a .htaccess for me when I created the redirect that contains the following:

Code:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^hamid.elaosta.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.hamid.elaosta.com$
RewriteRule ^/?$ "http\:\/\/hamid\.elaosta\.com\/wordpress" [R=301,L]

RewriteCond %{HTTP_HOST} ^hamid.hamid.x10.mx$ [OR]
RewriteCond %{HTTP_HOST} ^www.hamid.hamid.x10.mx$
RewriteRule ^/?$ "http\:\/\/hamid\.hamid\.x10\.mx\/wordpress" [R=301,L]

How do I modify this to include what you mentioned?
 

lemon-tree

x10 Minion
Community Support
Messages
1,420
Reaction score
46
Points
48
I'm not sure you can actually use DirectoryIndex to point to an index in another directory, but I may be wrong as I have never actually tried. You may have to use URL rewriting, as is already used in your .htaccess.
 

aliasneo

New Member
Messages
71
Reaction score
0
Points
0
I'm not sure you can actually use DirectoryIndex to point to an index in another directory, but I may be wrong as I have never actually tried. You may have to use URL rewriting, as is already used in your .htaccess.

Ok, how about I modify the root directory of that sub-domain to wordpress/. Would I still be able to access things above it is I specify them explicitly?
 

lemon-tree

x10 Minion
Community Support
Messages
1,420
Reaction score
46
Points
48
Are you looking to redirect only one single page? If so, you could just add this to the end of your .htaccess:
RewriteRule ^/$ /subfolder/index.html
Edit: Might be something wrong in there actually, so it might not work.
 
Last edited:

lemon-tree

x10 Minion
Community Support
Messages
1,420
Reaction score
46
Points
48
OK, that last one I gave you was wrong. If you just want to redirect the one page it is:
RewriteRule ^$ /wordpress/index.php
All other files will show the wordpress directory in the URL bar.

If you want all queries to go into Wordpress directory. e.g. http://hamid.elaosta.com/item to open http://hamid.elaosta.com/wordpress/item then use this one:
RewriteRule ^(.*)$ /wordpress/$1 [NC]
Note however that this may cause odd problems elsewhere if you have more than the wordpress installed as the wordpress directory will effectively become the root directory.
 
Last edited:

aliasneo

New Member
Messages
71
Reaction score
0
Points
0
Thanks, should I keep the rest of the redirect info in there or remove it all and replace with this? I'm sure I can live with this for now, when I make the others I may make them sub-domains like forum.hamid.elaosta.com but it depends on how ugly that is going to be, not a priority at the moment though.
 

lemon-tree

x10 Minion
Community Support
Messages
1,420
Reaction score
46
Points
48
I suggest you leave all the other things there and append that line on the end. Those other lines look like they are redirecting your old domain to your new one.
 

aliasneo

New Member
Messages
71
Reaction score
0
Points
0
I suggest you leave all the other things there and append that line on the end. Those other lines look like they are redirecting your old domain to your new one.

Apending didn't work, infact it made me competely unable to access the blog at all and I had to make some other changes.

Fortunately, Wordpress provides a simpler solution. The index.php for the blog can be shifted up as many directories as necessary from the content and then the only line of code in it edited to point to the correct subfolder (it chainloads the main content).

I think we can call it solved now, thanks for the guidance that eventually got me to a solution.
 
Status
Not open for further replies.
Top