Sub-domain URL is not working - .htaccess

I've created sub-domain URL on my site but it always shows "page not found" error. When I write foldername.website.com so it shows page not found but it works when I write website.com/foldername. I've removed all code of .htaccess from main folder and sub folder but still sub-domain URL is not working.

Your web folder design should be something like:
website.com
/ <root> -----> <content for website>
forum.website.com
/ <root> --------> <Content for subdomain website>
You really can not have a nested relationship for these two folders, like website folder cannot contain the subdomain folder; which looks to be the case here.

Related

Exclude a folder in Xenforo

I have installed Xenforo in my public_html in my Cpanel which means my forum is available in site.com
Now I want to add another folder contains my web app and want to access it in site.com/myapp. I created a folder "myapp" in public_htmll beside Xenforo files and now when I enter the URL site.com/myapp it goes to a 404 page of the forum. I need to Xenforo exclude this folder and let the app lunch in this address. How can I do that?
You should move your XenForo installation to a subdirectory - many people use site.com/community as the forum root and either have a separate home page at site.com/ or just redirect the domain root to the /community URL.
This then allows you to have other apps running in other subdirectories like site.com/myapp without issue.
In XenForo 2.x this works fine, If you have enabled full Seo friendly urls from admin panel, Make sure you have proper .htaccess file in place. In you case, I believe you did not upload .htaccess file in public_html folder

GoDaddy and .htaccess 301 redirects in subfolder

My website points to a sub-sub folder on the webroot on GoDaddy (/mywebsite/mywebsitesfolder). Apparently from my research, you cannot use a 301 redirect in an .htaccess file if it's in a subfolder of the webroot on GoDaddy. I've tried so many different things. My custom ErrorDocument statements work and bring up the error documents within this particular subfolder, of which my domain points to. What should I do to make this work aside from moving my website completely out of GoDaddy and to Bluehost?
rewriteengine on
redirect 301 /oldfile.html http://mynewsite/newfile.php
ErrorDocument 404 /.errordocs/404-missing.php
I am answering my own question here but it works like this. In order to successfully do a 301 redirect for domains pointing to subfolders on GoDaddy, you have to put the complete file path where you want the server to LOOK for the old file. I was getting confused because my old site was in a different folder and I was telling it to look in that old folder instead of the new folder I pointed the domain to. So my code would actually look like this instead of what's above in my question.
redirect 301 /mywebsitesfolder/oldfile.html http://www.newsite.com/newfile.html
No matter how many subfolders down in the webroot it is, you have to put the whole filepath. Im my case, my redirects now look like this:
redirect 301 /mywebsitesfolder/mywebsitesnewfolder/oldfile.html http://www.newsite.com/newfile.html

Missing htaccess file on server?

i've just created a website. It's hosted by GoDaddy and I use cPanel to manage it.
all of my files relating to my website are stored in a public_html folder.
The problem I am having is that I cannot seem to access different pages I have uploaded, I'll show what I mean.
www.website.com --> works fine (defaults to home.html)
www.website.com/About/about.html --> works fine
www.website.com.com/About --> I get the error below:
"You don't have permission to access /About/ on this server.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request."
I would like website.com/About to display about.html.
I think it may be something to do with the .htaccess file? I may of clumsily deleted it at some point.
I have tried to set permissions to 777 on all my public_html files, but I get the same error.
I have tried to locate my htaccess file, but I think its hidden by default. I've tried to find it using a terminal and connecting to my site - also with no success.
Any help to solve this issue would be great cheers!
If /About/ is a directory and these are static HTML files, rename about.html to index.html.
Servers will look for index.html in a directory if nothing else was specified in the URL.

htaccess rewrite not working beyond first directory

I have had to change the name of a page on my wordpress site. In the url structure the page has many sub pages which are illustrated as follows:
www.mysite.com/folder1/plus whatever else may come here
Basically I want to do a wildcard redirect where any URL matching the folder1 part of the URL gets caught and redirected to the following:
www.mysite.com/newfolder1/folder2/
The following redirect works for the above situation
RewriteRule ^folder1/?(.*) http://www.mysite.com/newfolder1/$1 [R=301,L]
But fails and give a 404 for the following
www.mysite.com/folder1/folder2/folder3
It will not redirect beyond the folder2 depth. Why is this?
Following up on the comments:
The problem sounds like the .htaccess file (or the rules you're talking about) is in the wrong location.
As far as my understanding goes, Apache reads all the .htaccess files (and other server configs that do redirects) from the "top" down - i.e., .htaccess files in subfolders are processed after .htaccess files in the root folder.

Use htaccess to rewrite folder.domain.com to www.domain.com/folder

I want to set up a blog on my current domain at
http://www.ashrobbins.com/folder/
and use htaccess so that it can be reached by simply going to
http://folder.ashrobbins.com
The rewrite I currently have in my .htaccess is below.
RewriteRule ^blog$ blog.php [L,NC]
But I get a page not found when I go to folder.ashrobbins.com in my browser...
You must setup ashrobbins.com in your host to serve content from a local folder, and add a 'folder' folder inside it.
And also setup folder.ashrobbins.com in your host to serve content from another local folder. As I can see, you haven't setup folder.ashrobbins.com nd therefore you receive that error.
It seems you are creating a new site and doesn't know how to do it. If it's new, just setup subdomain.ashrobbins.com and put your site on it. If there's nothing already served in ashrobbins.com/folder/ just don't mess with it.

Resources