Johny_Brav0
asked on
CentOS htaccess file question
I am trying to use an .htaccess file on my server to redirect www. requests to a URL without www..
I have made the .htaccess with htpasswd on my CentOS 5.8 server with the required 301 redirect line in it although it does not work.
I think the redirect does not work because it is not using the htaccess file at all i.e. I try to add junk to the htaccess to test if it is in use (website would not work with junk), and nothing happens.
Please suggest how I solve this or any more information that you require.
Regards
I have made the .htaccess with htpasswd on my CentOS 5.8 server with the required 301 redirect line in it although it does not work.
I think the redirect does not work because it is not using the htaccess file at all i.e. I try to add junk to the htaccess to test if it is in use (website would not work with junk), and nothing happens.
Please suggest how I solve this or any more information that you require.
Regards
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi, thanks for the replies.
I will try the virtual host one on Monday back at work.
The AllowOverride All idea I have tried although if I did that with another directory within the httpd.conf file would it disable the /var/www one? Just an idea.
I will try the virtual host one on Monday back at work.
The AllowOverride All idea I have tried although if I did that with another directory within the httpd.conf file would it disable the /var/www one? Just an idea.
ASKER
The reason I require the redirect is that we only have certificates for the URL without the www..
So I am trying to redirect to the URL with certificates so there are no certificate warnings.
I tried (exact code):
<VirtualHost *>
ServerName www.nine23appstore.co.uk
Redirect 301 / http://nine23appstore.co.uk
</VirtualHost>
And no luck, I also tried:
<Directory "/var/www">
Options Indexes FollowSymLinks MultiViews
AllOverride All
Order allow,deny
allow from all
</Directory>
With no luck.
On a CentOS setup the hosted files are in www I take it where the .htaccess file should be also?
Many thanks
So I am trying to redirect to the URL with certificates so there are no certificate warnings.
I tried (exact code):
<VirtualHost *>
ServerName www.nine23appstore.co.uk
Redirect 301 / http://nine23appstore.co.uk
</VirtualHost>
And no luck, I also tried:
<Directory "/var/www">
Options Indexes FollowSymLinks MultiViews
AllOverride All
Order allow,deny
allow from all
</Directory>
With no luck.
On a CentOS setup the hosted files are in www I take it where the .htaccess file should be also?
Many thanks
ASKER
Silly me, turns out I was using the wrong directory in CentOS however it was a www directory so that threw me.
Got the .htaccess file working although I need a wildcard certificate to cope with both URLs as the browser gives a warning when the new redirect occurs.
Thanks anyway
Got the .htaccess file working although I need a wildcard certificate to cope with both URLs as the browser gives a warning when the new redirect occurs.
Thanks anyway
ASKER
As I cannot get the .htaccess file to be used by the server I am trying to put a redirect in the httpd.conf file instead.
So I add:
Redirect / https://mywebsite.co.uk
The problem is that the website is then made inaccessable when I try to browse to it.
Please advise on this approach