How to make mod_rewrite * not * perform extension of the home directory when using .htaccess

The path to the file: /Users/user_name/Sites/example.com

Viewable: http://localhost/~user_name/example.com/

In the child directory ( chrome) I got .htaccessas follows:

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^rgba\((\d{1,3}%?,\s?\d{1,3}%?,\s?\d{1,3}%?,\s?[0-1]?\.?\d+)\)$ rgba.php?rgba=$1 [PT]

This matches the query, for example:

http://localhost/~user_name/example.com/chrome/rgba(255,255,255,0.5)

and should rewrite the request:

http://localhost/~user_name/example.com/chrome/rgba.php?rgba=(255,255,255,0.5)

I put rgba.php in the directory chrome. However, I get this msg error:

The requested URL /Users/user_name/Sites/example.com/chrome/rgba.php was not found on this server.

I read part of the extension guide for the Home directory and the [PT] flag, but that doesn't make any difference.

If I set vhost pointing to a directory example.com, it works. I would like it to work in both directions = P

So how do I do this?

I am running Apache / 2.2.15 (Unix) on Mac OS X

AllowOverride Sites All. , .

+3
3

, , , , VirtualHost DocumentRoot, .

+1

, . .

. , PT RewriteRule , .

, , . RewriteRule RewriteBase /~user_name/example.com/chrome/. ( ):

<SNIP> (2) [perdir /Users/colin/Sites/ajaxtest/] trying to replace prefix /Users/colin/Sites/ajaxtest/ with /~colin/ajaxtest/

UPDATE

, , , ... . , VirtualHost, .

+1

Allow overrides in your configuration file for your home directories.

-1
source

Source: https://habr.com/ru/post/1780208/


All Articles