Mod rewrite Mod_重写-缺少图像、样式和脚本

Mod rewrite Mod_重写-缺少图像、样式和脚本,mod-rewrite,Mod Rewrite,一开始我想让你们注意到,我确实试着在谷歌或stackoverflow中找到解决方案。我找到了一些提示,但它们对我不起作用,或者我只是没有按照说明去做 下面是我的网站目录: www.domain.pl/index.php <--index file www.domain.pl/images/ <--images folder www.domain.pl/styles/ <--styles folder, for now just 1 css file w

一开始我想让你们注意到,我确实试着在谷歌或stackoverflow中找到解决方案。我找到了一些提示,但它们对我不起作用,或者我只是没有按照说明去做

下面是我的网站目录:

www.domain.pl/index.php    <--index file
www.domain.pl/images/      <--images folder
www.domain.pl/styles/      <--styles folder, for now just 1 css file
www.domain.pl/script/      <--scripts folder, js files, and 1 php file called with include
www.domain.pl/font/        <--font files
第一部分,我试图在url的末尾添加“斜杠”,若用户并没有把它放在那个里的话。
http://domain.pl/index
->
http://domain.pl/index/
http://domain.pl/index/myaction
->
http://domain.pl/index/myaction/

问题
重写时是否可能跳过包含图像、脚本等的文件夹?或者我如何一次重写所有图像

附加问题

http://domain.pl/myaction/
直接重定向到
http://domain.pl/index.php?action=myaction
立即,无需将
/index/
放入其中?是的,我正在学习mod rewrite。

您不必在请求中包含
索引,只需包含参数。例如:

请求:
http://domain.pl/myaction

Options +FollowSymlinks -MultiViews
RewriteEngine On 
RewriteBase /

# Exclude existing files and directories.
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule .* -  [L]

# Get the parameter and pass it to index.php
RewriteCond %{REQUEST_URI} !index\.php  [NC]
RewriteRule ^([^/]+)/?  /index.php?action=$1  [L,NC]

你真的应该在htaccess中使用一个简单的php路由器脚本和一个简单的FallbackResource/index.php,我真的很想知道为什么php webdevs是唯一一个仍然像1999年那样编写代码的人……很好的答案。工作很有魅力,但在我接受它之前,我想学点东西。
-MultiViews
在这里做什么?是一种搜索形式,包括。基本上,这意味着服务器从几个可用文档中选择“与客户端功能最匹配”的文档。由于启用该选项后,
mod_rewrite
无法按预期工作,因此,就我所见,最好确保禁用该选项。另一方面,根据Apache文档,FollowSymlinks选项对于
mod_rewrite
来说是必须的。
Options +FollowSymlinks -MultiViews
RewriteEngine On 
RewriteBase /

# Exclude existing files and directories.
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule .* -  [L]

# Get the parameter and pass it to index.php
RewriteCond %{REQUEST_URI} !index\.php  [NC]
RewriteRule ^([^/]+)/?  /index.php?action=$1  [L,NC]