How do i change the .htaccess on cPanel's Online File Manager (ByetHost)? - .htaccess

I'm using ByetHost as my website's FTP service, i configure everything (besides uploading the stuff) via ByetHost's Vista Panel, which has a Online File Manager where i presume i could edit the .htaccess.
However when i arrive at the File Manager, i can't seem to find the .htaccess file, and there is also a lack of a Settings button too.
Here is what the File Manager looks like: (the htdocs is where all my website's stuff is at)
I know ByetHost and/or whatever this unknown File Manager is not well known, but i'd like to ask anyways if there's anyone that could help me on how to configure my .htaccess. I would appreciate it.

I had this issue too, and couldn't find any settings or otherwise.
So what I simply did was:
Just created a new file and named it .htaccess!
And a quick test, I put in the following to allow access to my .html pages without actually typing the extension:
RewriteEngine on
RewriteRule ^(.+)\.html$ /$1 [R,L]
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.*?)/?$ /$1.html [NC,END]
And it worked successfully.

Related

htaccess RewriteRule leaving the current directory scope

I'm creating a website based on wordpress on a hosting system (unfortunately not a dedicated system in this situation) and I am very limited in my configuration opportunities for Apache2.4.x / PHP8.
I was unable to convince my client to move to a more advanced environment, so I have to work with the given playground, as follows:
There is a website in /www/ which is linked to the domain (A-Record). There's an old man that maintains the current website until the new website is finished.
I am really not afraid that the old dev accesseses my development scope intentionally or uses PHP to do so to cause harm (he doesn't know PHP, he uploads locally generated HTML). He's an old man and I'm rather afraid that he accidently deletes, overwrites or moves my work while I'm working on the new website and I have to put it back together. He might be like "oh I don't know that folder" and it's gone.
My first task was to make and install certificates and enforce HTTPS, that worked pretty well so far.
Now I need www.domain.tld/dev/ to show the wordpress site, however the old developer can access the www scope and I really don't want him to mess with my code. He barely knows HTML.
In opposite to him, I have full access and can go outside of the /www/ directory, so I created a /wordpress/. Unfortunately I have no option to add a subdomain for that on said host, either.
Now here's where my problem and my approaches kick in, I am unable to move /www/dev/ to show the /wordpress/ content which is not inside of /www/.
Theoretically I would do this on my root server but my client wants the website development to happen in his webspace. That's a bit strange but no subject to change. Just take that as given fact please.
So my htaccess rules for this are not doing anything and I can not spot what's wrong.
(Note: The .htaccess is laying inside of /www/)
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^domain.tld [NC]
RewriteRule ^(.*)$ https://domain.tld%{REQUEST_URI} [R=301,L]
#RewriteBase /
#RewriteRule ^/dev /is/htdocs/wpCUSTOMERIDSTRIPPED/wordpress [QSA]
#RewriteRule ^/dev/(.*) /is/htdocs/wpCUSTOMERIDSTRIPPED/wordpress/$1 [QSA]
RewriteBase /is/htdocs/wpCUSTOMERIDSTRIPPED
RewriteRule ^/www/dev /wordpress [QSA]
RewriteRule ^/www/dev/(.*) /wordpress/$1 [QSA]
Thank you alot in advance.
Note: The search function did not help me further as I am moving outside of the scope of the active directory.

Joomla - htaccess Redirects Error

I've had a Joomla 2.5.28 site for quite a while now and recently changed hosting providers. On the new server I managed to get Joomla updated to 3.2.7 and get it to run normally.
Now for the tricky part:
On my previous hoster I had a second installation being kind of the gateway to the other site. It just lets you select language and that's it.
My domain is www.cyclingtoserve.at with Joomla Main being /joomla and Joomla portal being /3.1
I figured by adding a REDIRECT rule from / to /3.1 I could get the portal up and running again. Sadly not.
This is what I get:
I thought I could undo this by deleting the .htaccess file. The problem lives on though.
I've tried just about everything. Help is VERY MUCH appreciated!
Edit01: A bit more info may be interesting.
The Joomla install is in /joomla while the other page is in /3.1
The .htaccess file however was in the root directory.
Edit02: I have managed to remove the wrong redirection. Question is: What is the correct way to redirect people from www.cyclingtoserve.at to /3.1? (without it showing up in the address)
Edit03: Here is a graphical representation (FTP) of the folder structure.
ftp
In order to avoid the redirect loop, you need to first check to see if your are already in the /3.1/ folder. Try this:
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/3.1/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ http://%{HTTP_HOST}/3.1/$1 [L,R]
Sadly I've had to give up using .htaccess for the redirection.
I would have loved the recommended way (and still would like to know how).
Solution:
index.html in root has the following lines:
<frameset rows="100%" frameborder=0 framespacing=0 border=0>
<frame src="http://cyclingtoserve.at/3.1/" name="Content" noresize>
<noframes>
It may be the quick and dirty way of dealing with this issue, but it works.
If you can reproduce the same results with .htaccess, I'd love to tag it as an answer.

Can't get my Zend Framework 2 project working on hosting server

Currently I am developing a webshop in PHP. For this I use the Zend Framework 2.
All of my routes exist of a locale i.e. "nl_NL" or "en_EN", followed by a controller and an action www.mydomain.com/nl_NL/profile/login. Look here for an example of a route used in my project. This one belongs to the Profile Module: http://pastebin.com/jmim47w8.
If the visitor has no account, and no Cookie is set, the locale variable will first be set to the variable retrieved from the following function:
locale_accept_from_http($_SERVER['HTTP_ACCEPT_LANGUAGE'])
If a cookie is set that value will be used.
On the other hand, if a user does have an account and is logged in, the variable used will be retrieved from the user's profile.
My entire script does work on a localhost. However, on the server it doesn't.
When loading the page nothing gets shown. I have checked the error logs and couldn't find anything. However, when i place /nl_NL/ or any other locale that meets the requirements of the "locale route" regex in the url manually, it does work.
My first thought was that the url_rewrite apache module was not installed or activated, but since other websites use this module as well, and they are on the same server this doesn't seem logical. Of course I did try to check wether it was enabled by running some scripts, but to no avail. Since our server is setup to not allow shell scripts to be ran, or to check wether apache modules are enabled using phpinfo() it's quite hard to make sure.
I have tried to verify that my .htaccess file is correct, but I'm pretty much a noob at .htaccess. This is my .htaccess:
RewriteEngine On
# The following rule tells Apache that if the requested filename
# exists, simply serve it.
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
# The following rewrites all other queries to index.php. The
# condition ensures that if you are using Apache aliases to do
# mass virtual hosting, the base path will be prepended to
# allow proper resolution of the index.php file; it will work
# in non-aliased environments as well, providing a safe, one-size
# fits all solution.
RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::\2$
RewriteRule ^(.*) - [E=BASE:%1]
RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L]
To see what my IndexController looks like look here: http://pastebin.com/AEgm3Jmk.
All in all, I would really like to know how to get a Zend FW 2 project to work on a hosting server while still using url rewrite or any other way that makes it possible to use locale variables.
If there is something missing from this post that is needed to help me further, I will be happy to post it.
I have solved the problem, everything is working fine right now.
I found the problem to be in my local.php config file. The problem was
an error within this file, so it was actually a write error ( corrupt file ).
#Alex thanks for the help though, appreciate it.

Expression Engine - template page not showing

I have two pages on a site that I just completed that are no longer showing. I am running EE 2.2.2 and use .htaccess to hide the index page.
There are several templates in the same directory, all but two of them show correctly. For example:
This shows correctly: http://southernlivingplants.com/landscape
While these two do not:
http://southernlivingplants.com/grower
http://southernlivingplants.com/retailer
I get the following error message:
Index of /retailer
Parent Directory
Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2
mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 Server
at southernlivingplants.com Port 80
The problem I see is that neither /retailer or /grower are directories.
Here is the htaccess code:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]
I would appreciate some help in figuring this out.
Alas, user error. Someone else had created folders of the same name, which were in conflict with the template names.
If I put index.php in the URL the pages seem to come up, so it's probably an .htaccess issue. Have you been through the official docs for removing it? There's several options: http://expressionengine.com/user_guide/general/remove_index.php.html
Another idea...you said that retailer and grower are all in the same directory? EE doesn't generally work like that unless you're using Structure. Template groups define new top level directories and each template inside is a sub directory (other than the index). So in this case if they're all in the landscaping directory the urls' would be /landscaping/retailer and /landscaping/grower. Hope that helps!
It looks like you are using the "File and Directory Check" method for the .htaccess file for ExpressionEngine.
Are retailer and grower template groups or templates in EE?
Have you tried removing the ? after the index.php in the rewrite rule? What hosting company are you using?
I have had best success with the "Exclude" method myself.
http://expressionengine.com/wiki/Remove_index.php_From_URLs#Exclude_List_Method
You essentially put in the ReWriteCond the folders / files that you do NOT want EE to parse as if it's a template. So, your /images, /system, /themes, etc directories, if you end up having one for /js or another application, you just add them to that line. (Make sure to escape the periods.) I suggest trying that method. That way everything else will definitely go through EE.

.htaccess - How to hide the internal directory used by subdomains?

I installed a small FTP space for my classmates which allows them to upload school related documents to my server. After the files have been uploaded, they can be easily accessed via a subdomain i.e. ftp.mydomain.com
Everything is working fine, the files can be downloaded and everything works properly.
There are two things which still annoy me though:
If you enter ftp.mydomain.com you see Index of /my_internal_directory instead of something like Index of /
Once you enter a sub-directory and click the Parent Directory link it will redirect you to ftp.mydomain.com/my_internal_directory/ as well
Is there any way to hide my_internal_directory ?
This is the content of my .htaccess file so far:
RewriteEngine on
RewriteCond %{HTTP_HOST} ftp\.mydomain\.com
RewriteCond %{REQUEST_URI} !^/my_internal_directory/
RewriteRule ^(.*)$ /my_internal_directory/$1 [L]
Any help would be greatly appreciated.
If you are using linux server then you can remove read permission for folder my_internal_directory
If not resolve, try to add:
Options -Indexes
on top of the file.
If still doesnt resolve please post your .htaccess file... :)

Resources