这个mod_rewrite规则如何导致我的任何文件都无法加载?

The following mod_rewrite rule is causing my website to behave odd I type localhost/signin/.

Options +FollowSymLinks
RewriteEngine On

RewriteRule ^signin/?$ access.php [NC,L]

It causes all of the attached files (images, css, php, js) with relative links not to load? However when I type localhost/signin all the attached files with load like nothing is wrong. I think this happens because /signin/ is treated like a directory and all relative links will look into an non-existence directory for all the attached files.

Edit: I figured out a solution but it involves muddying up my markup which is not what I want. Look at my answer below and you'll see.

However, I want these attached files to be ignored by the rewrite rules.

The problem

The problem you have is (after clarification) not related to the use of rewrite rules. Please edit your question to accurately represent your problem.

Almost certainly because you have references such as:

<link rel="stylesheet" type="text/css" href="css/foo.css">
<script src="js/foo.js">

which means the route used to find the css/js files is dependent on the directory (virtual or real) of the current request.

If the current request is /foo, the request is in the root dir. As such, the following urls would be requested:

/css/foo.css
/js/foo.js

If, however the current request is /foo/, the request is in the dir /foo/. As such, the following urs would be requested:

/foo/css/foo.css
/foo/js/foo.js

Use absolute urls

The way to avoid this is simply to use absolute urls in your link/script tags:

<link rel="stylesheet" type="text/css" href="/css/foo.css">
<script src="/js/foo.js">

That way, irrespective of the current url - the exact url in the link and script tag is used.

Base tag - be careful

You can as you note in your own answer use the base tag - but it's much more obvious to not rely upon it. There are also problems with some browsers e.g. converting "#" into an a request for "/#" which is another reason to ignore the base tag's existence.

Since I do not have enough rep to upvote a proper answer, here it is: the answer by Stormy Weather is a very good thing to follow.

Not only will it serve all files directly, it will also do this for folders. This is very useful if you are starting a new temp project, or need some testing code out quick. Just create a new directory with an index.php in it, and the server will serve it just fine.

Of course, without the -d flag this will work too, but you have to type the entire filename too, which can be quite confusing.

Anyway, I'd have preferred to just upvote the answer above me, but alas.

After searching long enough I found that I could use:

<base href="/beta/" />

in the head section of each HTML file to fix the relative paths. I do not really care to much for this method as it muddies up my markup. If anyone else has ideas please share them with me.

By the way I'm using MAMP Pro on a Macbook Pro.