LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-15-2016, 11:25 AM   #1
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
Question Using rewriteoptions to replace htaccess?


I want to replace the use of ".htaccess" files with equivalent directives that are "Include"d directly into the configuration file ... with no overrides allowed. (htaccess is evil ...)

I am able to do this if I "Include" the file in each one of (several hundred ...) <VirtualHost> entries.

But I would like to include the file just once, and then use "RewriteOptions Inherit" to virtually-insert it at each spot. But the interpretation of the rules does not seem to be the same. (For instance, there is a "/" prepended to the URI string.)

The original "Include" is in the base config-file, outside of any VirtualHost.

Also, it is necessary (don't ask ... ) for each VirtualHost to have its own RewriteMap. Therefore, the rules, when applied in any host, must reference the maps defined in that host entry.

Can it be done?
 
Old 03-20-2016, 06:06 PM   #2
Norseman01
Member
 
Registered: Nov 2012
Posts: 85

Rep: Reputation: Disabled
Quote:
Originally Posted by sundialsvcs View Post
I want to replace the use of ".htaccess" files with equivalent directives that are "Include"d directly into the configuration file ... with no overrides allowed. (htaccess is evil ...)

I am able to do this if I "Include" the file in each one of (several hundred ...) <VirtualHost> entries.

But I would like to include the file just once, and then use "RewriteOptions Inherit" to virtually-insert it at each spot. But the interpretation of the rules does not seem to be the same. (For instance, there is a "/" prepended to the URI string.)

The original "Include" is in the base config-file, outside of any VirtualHost.

Also, it is necessary (don't ask ... :rolleyes) for each VirtualHost to have its own RewriteMap. Therefore, the rules, when applied in any host, must reference the maps defined in that host's entry.

Can it be done?
=====================================
I removed the font games directives to make reading the question easier.

VirtualHost(s) implies the potential for multiple OS's which can mean lots of NON-Linux commands running around inside any given machine.

IF the program reading the "outside" base commands can be directed there with a simple:
ln -s with_the_pointed_to_file the_pointer_to_file
you should be able to do as you are wanting. ... ln -s is SOFT-LINK (see man ln)
The link softlinked to item can be a file or directory or program...
Place the base commands in ... well whatever you want to call it ... and place the sys-wide stuff there. Put selective overrides in the chain of softlinks for the specific VirtualHost(s) to use. Each VHost can have it's specific overrides over ride where necessary and even groups of VHosts can be routed through the sane group specific overrides.

Kinda like building a pyramid with the "BASE" at the top and the groups/singles at the bottom. The adds/removes/changes occur in the routing back to the BASE. This works on paper, but I don't have enough machines to do a real test. I am also assuming that the VM setup/control software is Linux. If you are using VAX or DEC or WINDOW$ you are on your own.

I ran a short test using ln -s xx cc and the logic does work. Whether or not it works with the programs you are using is still up for grabs. xx and cc are just names for showing the syntax. xx is a target for program cc which executes commands and then calls the next layer and that does things and calls..... Again - a kind of Pyramid with the flow of actions proceeding upward rather than down. cc can be the same name (and even with the same instructions/configure tokens) in each directory back up the line.


Norseman01
 
Old 03-21-2016, 07:42 AM   #3
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659

Original Poster
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
In this situation, there are hundreds of online stores which are actually run by the same (Linux) software. All of their document-roots are, in fact, symlinks to the same location.

After bashing this thing around for a while, I finally just did a Include "filename" in each virtual-host's Directory and Location definitions, and moved on. (I also removed several hundred Deny from directives and moved them to Shorewall.) Fortuitously, Apache seems none the worse for wear.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to find and replace where the find is on two lines and replace on first line andrew777 Linux - General 9 08-05-2013 01:50 PM
[SOLVED] Sed replace Help replace for (<a> guessity Linux - Newbie 1 11-18-2011 09:05 AM
.htaccess artistik Linux - Software 1 10-23-2003 03:24 PM
problem in perl replace command with slash (/) in search/replace string ramesh_ps1 Red Hat 4 09-10-2003 01:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 11:06 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration