.htaccess redirect root to folder

I have two independend websites on my server. Of which one website is located in a subfolder of the other. Both websites are accessible over two different domains. Following the folder structure on my server:

Therefore, if I want to access website two I can do so with the following URLs:

one.com/folder
two.com

My problem: Using absolute paths to include files (css/js/img) in website two, I need to adapt my root depending over which URL the user access website two. Following an example for illustration:

The html file /www/folder/index.html contains an image:

<img src="/assets/img.jpg" />

If the user access this html file via the domain one.com/folder/index.html the image source path gets translated to one.com/assets/img.jpg where it won't find any image. Correct would have been one.com/folder/assets/img.jpg (one notice the folder in the path). Obviously, if the user calls two.com/index.html the problem doesn't exist.

Therefore, I thought I would change the root (base directory) of website two via .htaccess mod rewrite depending on which URL gets called. Following the simple pseudo code I would like to implement:

I would try with: Pattern regex = Pattern.compile("(?<= )\\d(\\d*[,\\.]?\\d+)*(?=[ .]?sq)"); where: (?<= ) - there is space before \d - starts with digit (\d*[,\.]?\d+)* - next is digit or digits, there could be comma or point with more digits - and it can repeats like in 100,000,000 (?=[ .]?sq) -...

When a new consumer joins a consumer group the set of consumers attempt to "rebalance" the load to assign partitions to each consumer. If the set of consumers changes while this assignment is taking place the rebalance will fail and retry. This setting controls the maximum number of attempts before...

The quotes are an issue but not the issue you are running into when you escape them. Your delimiter is terminating your regex just before the closing a which is giving you the unknown modifier error. It appears you don't have error reporting on though so you aren't seeing that....

You don’t have to fill your .htaccess file with thousands of lines of IPs. Instead, you can install a C library and an Apache module to do the heavy lifting for you. MaxMind provides a popular free database that is often used for IP lookups. Their GeoLite2 is a free...

Use \d+ to match one or more digits. \b(?:http:\/\/)?(?:www\.)?example\.com\/g\/(\d+)\/\w put http:// and www. inside a capturing or non-caturing group and then make it as optional by adding ? quantifier next to that group. For both http and https, it would be (?:https?:\/\/)? DEMO...

This is one way to do it, using preg_match: $string ="SomeStringExample"; preg_match('/^[b-df-hj-np-tv-z]*/i', $string, $matches); $count = strlen($matches[0]); The regular expression matches zero or more (*) case-insensitive (/i) consonants [b-df-hj-np-tv-z] at the beginning (^) of the string and stores the matched content in the $matches array. Then it's just a matter...

A variant of n-dru pattern since you don't need to describe all the string: SELECT '#hellowomanclothing' REGEXP '(^#.|[^o]|[^w]o)man'; Note: if a tag contains 'man' and 'woman' this pattern will return 1. If you don't want that Gordon Linoff solution is what you are looking for....

I think the /etc/hosts file configuration for the PC-A is not correct. ::1 ip6-localhost ip6-loopback www.test.tld The above mentioned entry seems to be problematic. Instead of that please point the IPv6 address of PC-A to www.test.tld and remove the entry for the www.test.tld from the loopback address....

The pattern attribute has to match the entire string. Assertions check for a match, but do not count towards the total match length. Changing the second assertion to \w+ will make the pattern match the entire string. You can also skip the implied ^, leaving you with just: <input pattern="(?!34)\w+"...

Try this one: SELECT * FROM employee WHERE REGEXP_LIKE (fname, '^pr(*)'); Fiddle This one also seems to work as far as I can tell: SELECT * FROM employee WHERE REGEXP_LIKE (fname, '^pr.'); Or another one that works: SELECT * FROM employee WHERE regexp_like(fname,'^pr'); ...

A work-around for the lack of variable-length lookbehind is available in situations when your strings have a relatively small fixed upper limit on their length. For example, if you know that strings are at most 100 characters long, you could use {0,100} in place of * or {1,100} in place...

At least, you can rely on the tag names and text, navigating the DOM tree horizontally - going sideways. These are all strong, p and span (with id attribute set) tags you are showing. For example, you can get the strong text and get the following sibling: >>> from bs4...

Using sqlite3 from bash on OS X seems fairly straightforward (I'm no expert at this, by the way). You will need to find out which table you need. You can do this with an interactive session. I'll show you with the database you suggested: /Users/fredbloggs> sqlite3 ~/Library/Application\ Support/Dock/desktoppicture.db SQLite version...

What you're looking for is called a character class. A character class is a group of characters that you're saying can be matched at that position in the string. To make a character class you enclose your list of matchable characters in square brackets, like this: [.,:;!?] This will match...

Could not figure out a regex solution, but here's a non-regex solution. It involves parsing numbers (not in curly braces) before each comma (unless its the last number in the string) and parsing strings (in curly braces) until the closing curly brace of the group is found. If regex solution...

Put dot and / inside a character class so that it would match .png or /png strings. var imageReg = /[\/.](gif|jpg|jpeg|tiff|png)$/i; Your regex would return true if there is a dot exists before png but here there exists a forward slash , so it fails....

To only allow digits, comma and spaces, you need to remove (, ) and -. Here is a way to do it with Matcher.find(): Pattern pattern = Pattern.compile("^[0-9, ]+$"); ... if (!m.find()) { evt.consume(); } And to allow an empty string, replace + with *: Pattern pattern = Pattern.compile("^[0-9, ]*$");...

You could convert this to a slightly more maintainable format, without getting into regular expressions. This is one way to use an array to accomplish your goal: // Super-quick one-liner: var str = '2042038423408'; var matchCount = $.grep(['12', '23', '34', '45', '56', '67', '78', '89', '90', '01'], function(num, i) {...

You can use this regex to test. It will ensure that after the @ there is .xx. but may also match the string @.xx.* .*@[^.]*[.]xx[.] Or this one to ensure that there is at least one character before and after the @. [email protected][^.]+[.]xx[.] ...

Updated: This will check for the existence of a sentence followed by special characters. It returns false if there are no special characters, and your original sentence is in capture group 1. Updated Regex101 Example r"(.*[\w])([^\w]+)" Alternatively (without a second capture group): Regex101 Example - no second capture group r"(.*[\w])(?:[^\w]+)"...

I don't understand why it would give me two hellos back? Because the first entry in the array is the overall match for the expression, which is then followed by the content of any capture groups the expression defines. Since the expression defines one capture group, you get back...

With such a small range you could just iterate the move_order and check if each element exists in the allowed moves def start(): move_order=[c for c in raw_input("Enter your moves: ")] moves = ['A','D','S','C','H'] for c in move_order: if c not in moves: print "That's not a proper move!" return...

In order to match the string with a literal backlash, you need to double-escape it in a raw string, e.g.: re.search(r'@CAD_DTA\\">(.+?)@[email protected]@CAD_LBL',result.text) ^ ^ In order to get the index of the found match, you can use start([group]) of re.MatchObject IDEONE demo: import re obj = re.search(r'@CAD_DTA\\">(.+?)@[email protected]@CAD_LBL', 'Some text [email protected]_DTA\\">I WANT...