How to allow htaccess

Ask questions about dedicated servers here and we and other users will do our best to answer them. Please also refer to the self-help section for tutorials and answers to the most commonly asked questions.
Post Reply
justin2234
A regular
A regular
Posts: 40
https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
Joined: Sat Oct 31, 2015 10:29 am

How to allow htaccess

Post by justin2234 »

Im wondering how do i enable htaccess, i searched some methods on google but most those methods point me to directories that i dont even have.
Im using a unmanaged linux vds with phpmyadmin+apache on it.

-Thanks
Image
User avatar
Spray
Former staff
Former staff
Posts: 630
Joined: Wed Dec 28, 2011 10:41 pm
Location: Oregon

Re: How to allow htaccess

Post by Spray »

A ".htaccess" file is read within any web folder for Apache. For instance, perhaps you set Apache to look for your web files in something like /var/www on your server. If you placed a .htaccess file within that folder, it would be read by Apache and used for all subfolders within /var/www.
justin2234
A regular
A regular
Posts: 40
Joined: Sat Oct 31, 2015 10:29 am

Re: How to allow htaccess

Post by justin2234 »

Spray wrote:A ".htaccess" file is read within any web folder for Apache. For instance, perhaps you set Apache to look for your web files in something like /var/www on your server. If you placed a .htaccess file within that folder, it would be read by Apache and used for all subfolders within /var/www.
Im not sure what you mean. I did some research and they showed that theirs a file that you need to allow htaccess like Allow like. From here https://www.velocihost.net/clients/know ... x-VPS.html

The thing is i transfered my subdomain /store from a basic nfo web hosting to my unmanaged vds and the products arent showing up, and i have the DB and files all transfered so only thing could be is htaccess not being allowed. So i want it to have access from the sudfolder domainname.com/store
Image
User avatar
Spray
Former staff
Former staff
Posts: 630
Joined: Wed Dec 28, 2011 10:41 pm
Location: Oregon

Re: How to allow htaccess

Post by Spray »

Ah, so you have a .htaccess file present, but the file isn't being loaded? In that case, you will need to ensure that your Apache configuration is looking for and reading .htaccess files. The "AllowOveride" setting, as stated in your linked article, is the correct setting to alter. If you're using something like Ubuntu and its default Apache2 setup, the configuration file should be located at /etc/apache2/apache2.conf

You may see a section like this:

Code: Select all

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>
You'd want to change this to:

Code: Select all

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
</Directory>
justin2234
A regular
A regular
Posts: 40
Joined: Sat Oct 31, 2015 10:29 am

Re: How to allow htaccess

Post by justin2234 »

Ok i did that then reboot the vds and it seems like my sourcebans and the store website is down for past 20 mins and nothing is even working anymore. And my sourcebans website is going like 10x slower now since i reboot the vds, what the hell. RIP
Image
justin2234
A regular
A regular
Posts: 40
Joined: Sat Oct 31, 2015 10:29 am

Re: How to allow htaccess

Post by justin2234 »

The error i get for the store is this now

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at webmaster@localhost to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.
Image
doulos9
This is my homepage
This is my homepage
Posts: 200
Joined: Sun Sep 15, 2013 9:44 pm

Re: How to allow htaccess

Post by doulos9 »

That usually means you have a configuration error inside your htaccess file. This file must be perfect. Apache doesn't guess what you mean - it either reads it exactly, or it finds an error and returns the 500 error.

Check it again.
justin2234
A regular
A regular
Posts: 40
Joined: Sat Oct 31, 2015 10:29 am

Re: How to allow htaccess

Post by justin2234 »

doulos9 wrote:That usually means you have a configuration error inside your htaccess file. This file must be perfect. Apache doesn't guess what you mean - it either reads it exactly, or it finds an error and returns the 500 error.

Check it again.
I dont get how i would have an error if it worked perfectly on my other hosting. I didnt change the htaccess file.
Image
doulos9
This is my homepage
This is my homepage
Posts: 200
Joined: Sun Sep 15, 2013 9:44 pm

Re: How to allow htaccess

Post by doulos9 »

Ah, OK. You need to follow the advise from spray here: viewtopic.php?p=70209#p70209.
justin2234
A regular
A regular
Posts: 40
Joined: Sat Oct 31, 2015 10:29 am

Re: How to allow htaccess

Post by justin2234 »

doulos9 wrote:Ah, OK. You need to follow the advise from spray here: viewtopic.php?p=70209#p70209.
I did tho... and restarted the vds and i get that internal error i sent above.

EDIT: Maybe set the directory to
<Directory /var/www/html/store>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>


???
Image
justin2234
A regular
A regular
Posts: 40
Joined: Sat Oct 31, 2015 10:29 am

Re: How to allow htaccess

Post by justin2234 »

Just checked my apache error log and im getting this

/var/www/html/store/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration
Image
justin2234
A regular
A regular
Posts: 40
Joined: Sat Oct 31, 2015 10:29 am

Re: How to allow htaccess

Post by justin2234 »

FIXED

Research goes a long way, so what i did was go into my VNC Console and typed sudo a2enmod rewrite then service apache2 restart and it worked!

which pretty much enables mod_rewrite and it worked flawless.
Image
Post Reply