0

So, I wanted to organise my projects for better developing. I chose using this way to organise folders & files:

www
 projects
 project1
 web
 design_tests
 project2
 web
 design_tests
...

The website of each project will go inside its "web" folder. I also wanted to access the web on the browser without putting the "web" folder name, so:

http://localhost/projects/project1
will access the physical files of:
/www/projects/project1/web

I accomplished that adding the next line to my /etc/apache2/sites-available/default file:

AliasMatch ^/projects/([^/]*)(/.*)? /www/projects/1ドル/web2ドル

Works perfectly. The problem is, in some websites, i have an .htaccess file with some RewriteRule rules. An example:

RewriteEngine On
RewriteRule styles\.css styles_20120107.css

They used to work without the alias and acessing normal. Now they don't. It redirects to the URL /project1/web/styles_20120107.css, and of course, the browser can't get it because of the Alias. I don't really know how to solve it. Can you give me some help about it please? If possible, doing modifications in the file /etc/apache2/sites-available/default, not on the .htaccess, because i want the websites to be cross-server.

Thanks in advance :)

asked Apr 12, 2012 at 19:28
9
  • Add [PT] flag for such rewrite rule: httpd.apache.org/docs/current/rewrite/flags.html#flag_pt Commented Apr 12, 2012 at 21:57
  • Already tried it, no result. If it should work this way, why it isn't? Commented Apr 12, 2012 at 22:25
  • The link I gave you has explanation. Commented Apr 12, 2012 at 22:48
  • So, i should rewrite to -? How? I'm sorry, my english is not the best :/ Commented Apr 12, 2012 at 23:03
  • This is the idea: RewriteRule styles\.css styles_20120107.css [PT] (assuming your rule is correctly working). I do not have (and never had) this kind of rewrite rule where incoming and outgoing file are in the same location. I have always had similar to what you see in that link, where new rewritten url has alias in it and it works just fine with PT flag. BTW -- instead of doing that alias thing -- better use rewrite rule to achieve the same -- in this case you should avoid this issue altogether Commented Apr 13, 2012 at 0:19

1 Answer 1

1

If adding [PT] flag does not work for you ... why not replace alias thing with rewrite rule to achieve the same -- in this case you should avoid this issue altogether.

answered Apr 13, 2012 at 8:43
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.