htaccess index files issue - html5boilerplate - .htaccess

I'm using html5boilerplate .htaccess file on one of my projects and i'm having some problems trying to make it works properly.
The main problem is that on sub-directories the index.hmtl file won't load automatically if you type in the address bar its main directory path.
If you try to access to http://provaeur.altervista.org/sitovino/en/wines/ you can see an example. In the directory "wines" there is actually an index.html file but instead of the index you can see a 403 error :(
I've tried to comment these lines:
<IfModule mod_autoindex.c>
Options -Indexes
</IfModule>
but it seems not to be the solution.
Here you can find a .txt copy of my .htaccess file:
http://provaeur.altervista.org/sitovino/htaccess.txt
Thanks for helping an italian noob :)

Related

Codeigniter4 htaccess file wont work with options all - indexes

i want to setup a new codeigniter4 project.
I've upload all files into www.mydomain.com/sub1/sub2
The htaccess files into www.mydomain.com/sub1/sub2/public makes some trouble.
If i use the default file, i always get a "500 Internal Error"
So i check line by line. so i figure out that the line "Options All -Indexes" produce this error. If i delete it, i see the welcome page. But i think there is a reason why i should add this and related to this "Options +FollowSymlinks" too.
What can caused this problem. In my codeigniter3 projects i use
"DirectoryIndex index.php
Options -Indexes"
and it works fine. Codeigniter4 seems to need it into another way.
After hours of testing and trieing, i find a way (but i not really understand why).
Changing the htacess file in the public folder
from
Options All -Indexes
Options +FollowSymlinks
to this
Options -Indexes
Options SymLinksIfOwnerMatch
solved the problem and the codeigniter project is viewable. So maybe it could help someone.

How to change base_url in drupal 7, fail to find answer online

I am trying to change base_url on my drupal 7 website, but failed to do it and google a lot, still could not solve it .
I am running localhost/drupal "on my local server. but I want to run it like
" localhost ". ( sorry I have to get rid of http://, otherwise it doesnot let me post)
How to get rid of folder in the url. I know I need to change $base_url on sites/default/setting.php to
$base_url = 'localhost'; // NO trailing slash! ( sorry I have to get rid of http://, otherwise it doesnot let me post)
And in the .htaccess file I am so confused what should I change. People online have their own solution, some said they work , some could not . Could someone give me some suggesttion ?
I assume this has to do with where you have placed your files.
In your file system, remove the 'drupal' directory and place all the files within that at /var/www/html ... instead of /var/www/html/drupal, if that's how it is currently set up.
I feel your pain; I've had this trouble myself before and I believe I had to alter both the settings.php and the htaccess (but try one at a time to begin with). I'm fairly sure that the section below in your .htaccess is what needs changing (just remove the hash from in front of the RewriteBase line). If you're unsure of what you're doing, make a copy of your .htaccess as htaccess.txt and then you can always switch back over if things get nasty.
# Modify the RewriteBase if you are using Drupal in a subdirectory or in a
# VirtualDocumentRoot and the rewrite rules are not working properly.
# For example if your site is at http://example.com/drupal uncomment and
# modify the following line:
# RewriteBase /drupal
I just realised that what you need is a re-write rule in an .htaccess file within your root folder (not the one that's inside the drupal folder). First, undo any edits you've already made, then create an .htaccess file in the same folder that contains your drupal folder and in it, add:
RewriteEngine On
RewriteRule ^$ /drupal [L]
That should send any traffic from the root into the drupal file structure. If you get issues with strange css, or urls that include the /drupal path, you'll need to revisit the other options in the /drupal/.htaccess file and your settings.php file in order to get it all working correctly.
However, going down this route, you may as well just copy all the files and folders into the root directory anyway (as the first answer suggested), assuming you're not going to be running multiple sites. If you do want to be testing multiple sites, you can just change the RewriteRul above to whatever site directory you're wanting to test in future.

htaccess rewrite resulting in 500 Internal Server Error

I am trying to get pretty urls using htaccess for SLIR image resizing plugin.
I want to rewrite something like below:
Before Rewrite:
localhost/img/600x400/slider/image.jpg
After Rewrite
localhost/application/public/slir/index.php?r=slir&w=600&h=400&i=img/slider/image.jpg
But the following code is returning a 500 Internal server error...
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)/([0-9]{1,4})x([0-9]{1,4})/(.*)\.(gif|jpg|jpeg|png) application/public/slir/index.php?r=slir&w=$2&h=$3&i=$1/$4.$5 [NC,NE,QSA,L]
</IfModule>
Please help me.....
UPDATE
I thought it was a File Permissions issue...
so I checked all the related directories and files, surprisingly there were all 755/644.
Then I directly checked the /application/public/slir/index.php. It was not accessible.
I created another file named hello.php in the same slir directory and hello.php was accessible.
Then I moved the SLIR directory to the another folder named public. Here, both the index.php and hello.php were accessible.
After that, I moved SLIR directory to back to the original scripts folder. In scripts folder, hello.php is accessible but index.php is not accessible.
Now, Both files have same permissions and are in same folder.. I dont know what is happening here... :/ :/
Someone please help me......
In case anyone else is looking at this - the problem I found was these two lines in the htaccess file:
php_value auto_prepend_file none
&
php_value auto_append_file none
some servers don't allow them.
moving them to my php.ini file solved it for me:
auto-prepend-file = none
auto-append-file = none
That is probably because you are editing the .htaccess file with a Windows based editor like notepad. Notepad adds some characters to the file which you can't see, but they mess with the .htaccess. I recommend using an editor like Notepad++ and setting the mode to Unix, so it won't mess with the server..
Speaking technically that is because Linux and Windows have different type of EOL ( End Of Line ) so that notepad adds some characters to the end of every line to go to the next line, but Unix won't recognize them, because it has it's own type of EOL..
Slashes are normally forbidden in query strings, but you can enable them by setting
AllowEncodedSlashes directive.
You may also want your rewrite rule to use percent encoding for slashes (that is %2F) so after rewrite:
localhost/application/public/slir/index.php?r=slir&w=600&h=400&i=img%2Fslider%2Fimage.jpg
See also How do you configure apache php to accept slashes in query strings
Duplicate, phrased very differently:
Has anyone used Smart Image Resizer on subdomain sites?
The problem is the subdomain...

.htaccess mod_rewrite trouble

So here's the thing .. I've been working on my webpage for some time now. I have a .htaccess in the root folder that contains only a few rows of rewriting rules and nothing else. It works fine on localhost but when I upload it to my host it just throws 404 error (my host is 000webhost.com). I tried eliminating every rule one by one to see where the error is, but nothing happened, I even deleted the contents of the .htaccess file and still it gives a 404 error. The only solution that worked (so far) was deleting the .htaccess file and only then the homepage appears. Any suggestions?
I just found out that my host doesn't support UTF8 encoding (i guess?) in .htaccess file so i changed the encoding to ANSI and it did the trick.
Have you tried the suggestion on your web host's site:
http://www.000webhost.com/faq.php?ID=16
they are suggesting you put this at the top of your .htaccess
RewriteBase /

.htaccess can't redirect .pl files

Has anyone had an issue where you try and do a redirect of a .pl file and that file just shows up as forbidden?
Here is an example of what I'm trying to do:
(http://www.oldsite.com/folder/sample.pl)
needs to redirect to...
(http://www.newsite.com/newpage/)
Here is what I have put in the .htaccess file which is located in folder on the old site (because I don't have access to the web root .htaccess file):
#the first line should allow the pearl file extension to execute
Options ExecCGI FollowSymLinks
RewriteEngine on
RewriteRule ^sample\.pl$ http://www\.newsite\.newpage/ [R=301,NC]
Though, I only get a forbidden page when I go to (http://www.newsite/folder/sample.pl). Even without the .htaccess file in place I still get a forbidden page. It's only .pl files that cause this forbidden page. If I go to any of these fake pages (sample.asp, sample.jsp) they bring up the proper "Page Not Found" message.
Can anyone think of any ideas to get around this .pl extension issue?
Thank you!

Resources