How do I redirect a subdirectory to a root directory?
Redirect subdirectory to root using . htaccess
- 1) Redirect from http://www.mysample.com/subdir/ {article-url} to http://www.mysample.com/ {article-url}
- 2) Redirect from subdomain’s subdirectory (sub.mysample.com/subdir/{article-url}) to http://www.mysample.com/{article-url}
How do I redirect a subfolder?
How To Redirect To Subfolder Using . htaccess
- Open .htaccess file. You will typically find .htaccess file in your site’s root folder (e.g /var/www/html/).
- Redirect to Subfolder. There are multiple ways to redirect to subfolder (e.g /product).
- Restart Apache Server.
How do I redirect Apache default page to a subdirectory?
How to Rewrite URL to Subdirectory in Apache
- Enable mod_rewrite. We will be using mod_rewrite for our purpose.
- Rewrite URL to Subdirectory. Open .htaccess file at your website’s root folder $ sudo vi /var/www/html/.htaccess.
- Restart Apache Server. Restart Apache server to apply changes.
How do I redirect a primary domain to a subdirectory?
In order to also set up your main domain to use a subdirectory on your hosting account, you will need to set up a redirect in the . htaccess file in the public_html folder so that the server knows that any request for your main domain will be redirected to a subdirectory on public_html.
How do I redirect a folder?
Right-click a folder that you want to redirect (for example, Documents), and then select Properties. In the Properties dialog box, from the Setting box, select Basic – Redirect everyone’s folder to the same location.
Can I point a domain to a subfolder?
Click on “Hosting” on the left side of the page under “My Products,” then click on “Manage Account” and choose “Domain Management” under “Settings.” Click “Add Domain.” Enter the new domain name in the field marked “Domain,” and enter the sub-folder that will contain the site in the “Folder” field.