
13th August 2010, 16:13
|
|
Member
|
|
Join Date: Jan 2010
Posts: 79
Thanks: 7
Thanked 3 Times in 3 Posts
|
|
Mod-Rewrite Rule to Effect All Domains
Hey all, just a simple question, which file can I put an rewrite rule into which will effect all domains.
I use httpd.conf for an apache alias which affects all domains, but adding the rewrite rule does not. Where could I possibly insert it to effect all of my sites?
|

14th August 2010, 15:48
|
|
Super Moderator
|
|
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,665
Thanks: 1,896
Thanked 2,592 Times in 2,443 Posts
|
|
According to http://httpd.apache.org/docs/2.2/mod...ml#rewriterule , you can put it in the server config, virtual host, directory, .htaccess.
|

14th August 2010, 20:47
|
|
Member
|
|
Join Date: Jan 2010
Posts: 79
Thanks: 7
Thanked 3 Times in 3 Posts
|
|
Hi Falko, I've read through the documentation and I'm adding the correct rules etc. The thing is, the code doesn't work in any file but the .vhost for specific domains.
I want to achieve a mod rewrite which is applicable to every domain by setting the rule once is one file (httpd.conf). Surely this is a common action which people use.
Have you got a rule which I can use and modify that effects all domains?
|

15th August 2010, 18:04
|
|
Super Moderator
|
|
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,665
Thanks: 1,896
Thanked 2,592 Times in 2,443 Posts
|
|
What exactly did you add in your main Apache configuration?
Any errors in Apache's error log?
|

16th August 2010, 00:04
|
|
Member
|
|
Join Date: Jan 2010
Posts: 79
Thanks: 7
Thanked 3 Times in 3 Posts
|
|
Hi Falko, I added these lines into httpd.conf which were taken straight from the domain's .vhost file. Apache is not throwing any errors at all. I have tested this rule in all the configuration files in the /etc/apache2/ directory but no luck. I am restarting apache every time I modify a file.
Code:
RewriteEngine on
RewriteRule ^/admin$ http://%{HTTP_HOST}:8080/ [L,R=301]
|

16th August 2010, 13:40
|
|
Super Moderator
|
|
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,665
Thanks: 1,896
Thanked 2,592 Times in 2,443 Posts
|
|
And it's working inside a vhost configuration, but not in the main Apache configuration?
|

16th August 2010, 13:53
|
|
Member
|
|
Join Date: Jan 2010
Posts: 79
Thanks: 7
Thanked 3 Times in 3 Posts
|
|
Yes, httpd.conf is the main configuration file. I have other global setting in there that are working such as Alias etc.
|

17th August 2010, 18:34
|
|
Super Moderator
|
|
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,665
Thanks: 1,896
Thanked 2,592 Times in 2,443 Posts
|
|
That's strange...
|

17th August 2010, 22:24
|
|
Member
|
|
Join Date: Jan 2010
Posts: 79
Thanks: 7
Thanked 3 Times in 3 Posts
|
|
Honestly try it yourself, I've done a fresh server install and its still the same
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT +2. The time now is 05:06.
|
Recent comments
1 day 20 hours ago
2 days 4 hours ago
2 days 7 hours ago
2 days 8 hours ago
2 days 10 hours ago
2 days 12 hours ago
2 days 13 hours ago
2 days 14 hours ago
3 days 6 hours ago
3 days 7 hours ago