Need to show static directory located in root of WP install - .htaccess

I'm trying to navigate to a directory (/mobileapp/) containing a static mobile web app, located in the root of my WP install.
My problem is that when I try going to the url (http://dawsondental.ca/mobileapp/ <--the live site if you want to check it out) I get the usual WP 404 Not Found page.
I tried creating an .htaccess file within the /mobileapp/ directory with the following:
<IfModule mod_rewrite.c>
#Disable rewriting
RewriteEngine Off
</IfModule>
But it's still not working. Maybe the WP permalink rewrite conditions are still taking over? Any ideas?

Move the WordPress/MobileApp directory out of WordPress to your Web Root folder (say, /public_html or /www). Then try accessing it as http://dawsondental.ca/mobileapp/.

Related

How to redirect non www to www for prod website

I've tried to add the item below in .htaccess(wamp64\bin\apache\apache2.4.37\conf) and enabled Use URL Rewriting in Joomla however when I try to type abc.com in search engine address bar it will still redirect me to search page instead of redirecting me to the website. I've also performed checking and confirmed that .htaccess file is readable, the webpage is work when go to https://www.abc.co m however redirection still not work. I just need the page to redirect from http://abc.co m to https://www.abc.co m Is there any other way to do it? Or I'm doing it wrongly?? Please help.
RewriteCond %{HTTP_HOST} ^abc.com [NC]
RewriteRule ^(.*)$ https://www.abc.co m/$1 [L,R=301]
The redirect itself works great. The issue is where you've put the file.
.htaccess files are meant to be in the root folder and sub-directories of your website, not in the config files for Apache. Think of them as configuration files the server will find on-the-fly as it serves up documents, not static configurations loaded when the server starts (which are found in the "conf" folder you referred to). (See https://httpd.apache.org/docs/current/howto/htaccess.html)
For WAMP, the root folder is typically a folder called "www" and is normally located at c:/wamp/www. See Where is the web server root directory in WAMP? More commonly, though, this folder is called "public_html" (such as with LAMP, XAMP, MAMP, or default Apache installs).

Redirect existing second page to non-existing url

I have a site https://sitename.com/web (example). So, full path to page is sitename.com/web/index.php. On ftp server there is folder /web which also contain second page file - index-2.php. How to avoid creating /web-2/ folder and redirect index-2.php to sitename.com/web-2 ?
Easy, create an .htaccess file inside the root folder of your site, then add the following lines to it:
RewriteEngine On
RewriteRule ^web-2$ index-2.php [QSA,L,NC]
This site might help you with htaccess:
https://www.htaccessredirect.net/
A nice tutorial on .htaccess files also below:
https://www.digitalocean.com/community/tutorials/how-to-use-the-htaccess-file

500 Internal Server Error for sub domain using htaccess in SilverStripe 3.1

I am getting a 500 server error for a sub domain. It was working perfectly before installing SilverStripe 3. Is there any modification needed in the default .htaccess created by SilverStripe installation?
This answer makes a few assumptions from your question.
These assumptions are
Your SilverStripe website is the root website (e.g. http://www.example.com)
Your SilverStripe code is in the root web directory (e.g. /public_html)
You sub-domain code is in a sub-folder of the root web directory (e.g. /public_html/sub
The problem that can occur in the above situation is the sub-domain may use the /public_html/.htaccess file and use its mod_rewrite rules.
To solve this we can create a .htaccess file in the sub-domain (/public_html/sub/.htaccess) with the following code:
<IfModule mod_rewrite.c>
SetEnv HTTP_MOD_REWRITE On
RewriteEngine On
RewriteBase /
</IfModule>
This will tell the server to not use the mod_rewrite rules or base of the root .htaccess file.
An alternative solution could be to not place sub-domain code in a sub-folder of the root web directory. You can create a folder on the root level such as /sub and have your sub-domain point to there.
Thanks every one for their support, but I follow different method.
I have created sub domain from cpanel, but selected same root folder instead of creating new directory.
I got the help from here.
https://forums.cpanel.net/threads/domain-redirecting-to-cgi-sys-defaultwebpage-cgi.139597/page-3#post-656642

RewriteBase in Drupal not working

I just developed Drupal based website, instead of old one "custom" made.
Problem I'm facing is that root of website is not apache root. It is in directory:
/public_html/mydomain/htdocs/
Due to all of that, my links now looks like:
http://www.mydomain.com/mydomain/htdocs/php
http://www.mydomain.com/mydomain/htdocs/java
http://www.mydomain.com/mydomain/htdocs/jquery
Tried to change directive in Drupal's .htaccess file, with:
RewriteBase /mysite/htdocs
... but that made no changes to links.
Also, with previous website all links worked fine...
Can you tell me how to fix this directive.
Thank you in advance!
RewriteBase is not used for that purpose. You need to be editing the virtual host or vhost file. Find the vhost file in your apache configuration and change the DocumentRoot to your folder /public_html/mydmian/htdocs/ and just comment-out rewritebase.
RewriteBase is if your site is in a sub-folder of a "document root." What you have IS the document root.

How to set the default website page through htaccess?

I am currently setting up a website from a client on his hosting account. The website address and for some reason doesn't default to .php files (that is: index.php). If I put index.php and there is no index.html file I receive the following error:
If you feel you have reached this page in error, please contact the
web site owner: someemail#example.com If you are the web site owner,
it is possible you have reached this page because: The IP address has
changed. There has been a server misconfiguration. The site may have
been moved to a different server. If you are the owner of this website
and were not expecting to see this page, please contact your hosting
provider.
His hosting is a shared hosting on cpanel.
Use the DirectoryIndex directive in your .htaccess file
DirectoryIndex index.php
The problem was caused by my web-browser cache, as soon as I have cleared my cache it worked!
Try
DirectoryIndex index.php
if that doesn't work you might have to work around it by providing index.html like
<html><frameset rows="*"><frame src="index.php"></frameset></html>
(ofcourse more elaborate)
You can set your default page as the directory index using .htaccess file in 2 ways.
First method
DirectoryIndex yourfile.php
Above code will set 'yourfile.php' as the directory index. But this will applies to all sub folders as well and may occur '404' error for some related urls.
Second method
Use this code to set your handler file for the root directory
RewriteEngine on
RewriteRule ^$ /yourfile.php [L]
If you want to set a handler file for the sub folder, use this one
RewriteEngine on
RewriteRule ^subfolder/$ /yourfile.php [L]
enter image description here
im getting this error...
enter image description here
i found this line in index.php
how to remove this defualt page and make my website live

Resources