Php 相对路径不';在添加用于追加尾部斜杠的重写规则后无法工作

Php 相对路径不';在添加用于追加尾部斜杠的重写规则后无法工作,php,apache,.htaccess,mod-rewrite,url-rewriting,Php,Apache,.htaccess,Mod Rewrite,Url Rewriting,我在/forum/section1/中有一个索引页,我有一个规则,当我浏览exampledomain.com/forum/section1/时,可以自动重定向到索引页。有时,当我忘记了尾随斜杠时,它会继续加载,并且永远不会进入索引页。我添加了一条规则,在每个请求后都附加一个尾随斜杠: RewriteEngine on #From http://enarion.net/web/htaccess/trailing-slash/ RewriteBase / RewriteCond %{REQUEST

我在
/forum/section1/
中有一个索引页,我有一个规则,当我浏览
exampledomain.com/forum/section1/
时,可以自动重定向到索引页。有时,当我忘记了尾随斜杠时,它会继续加载,并且永远不会进入索引页。我添加了一条规则,在每个请求后都附加一个尾随斜杠:

RewriteEngine on
#From http://enarion.net/web/htaccess/trailing-slash/ 
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
# Don't apply to images/css/js/ajax files
RewriteCond %{REQUEST_URI} !^.*\.(jpg|jpe?g|ico|css|js|gif|png|php)$ [NC]
RewriteRule ^(.*)$ http://exampledomain.com/$1/ [L,R=301] 

RewriteCond %{REQUEST_FILENAME} -d 
RewriteCond %{REQUEST_FILENAME} -f 
RewriteCond %{REQUEST_FILENAME} -l
RewriteRule ^ - [L]
RewriteCond %{REQUEST_URI} !^.*\.(jpg|jpe?g|ico|css|js|gif|png)$ [NC]

#Remove php extension
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule !.*\.php$ %{REQUEST_FILENAME}.php [QSA,L]

RewriteCond %{THE_REQUEST} /index\.php [NC]
RewriteRule ^([^\.]+)$ $1.php [NC,L]
规则正在运行,但所有的相对路径都无效。例如,我在索引页上有一个表单:

       `<form action='index' method='POST'></form>`
``

它不会访问
exampledomain/forum/section1/index/
,而是重定向到
exampledomain/forum/section1/index/index
。我知道将相对路径更改为绝对路径可以解决问题,但是有没有办法用重写规则来解决这个问题呢?

你的.htaccess在哪里?你可以在网页HTML的
部分添加这个:
但是你的链接应该是:
@PanamaJack我把所有的规则都放在apache配置文件中。你的.htaccess在哪里?你可以在你的网页的HTML:
但是你的链接应该是:
@PanamaJack我把所有的规则都放在apache配置文件中了。你的.htaccess在哪里?你可以在网页的HTML:
部分添加它:
但是你的链接应该是:
@PanamaJack我把所有规则都放在apache配置文件中了。