目前,如果我去我的网站......
example.com OR example.com/index.php
......我被重定向到......
example.com/
但是,我想在访问主页时停止添加培训。
以下是我的htaccess文件...
IndexIgnore *
ErrorDocument 400 /error
ErrorDocument 401 /error
ErrorDocument 403 /error
ErrorDocument 404 /error
ErrorDocument 500 /error
RewriteEngine on
RewriteBase /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ / [R=301,L]
RewriteRule ^(home|cv|handouts|links|contact|copyright|cv)/?$ /index.php?module=home&action=$1
RewriteRule ^(log(in|out))/?$ /index.php?module=authentication&action=$1
RewriteRule ^photos/?$ /index.php?module=gallery&action=album&album=general
RewriteRule ^gallery/?$ /index.php?module=gallery&action=album&album=general
RewriteRule ^gallery/([^/\.]+)/?$ /index.php?module=gallery&action=album&album=$1
RewriteRule ^gallery/([^/\.]+)/([^/\.]+)/?$ /index.php?module=gallery&action=album&album=$1$&page=$2
RewriteRule ^gallery/([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ /index.php?module=gallery&action=item&album=$1$&page=$2&item=$3
RewriteRule ^release/?$ /index.php?module=release&action=release
RewriteRule ^error/?$ /index.php?module=error&action=error
IndexIgnore *
ErrorDocument 400 /error
ErrorDocument 401 /error
ErrorDocument 403 /error
ErrorDocument 404 /error
ErrorDocument 500 /error
RewriteEngine on
RewriteBase /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ / [R=301,L]
RewriteRule ^(home|cv|handouts|links|contact|copyright|cv)/?$ /index.php?module=home&action=$1
RewriteRule ^(log(in|out))/?$ /index.php?module=authentication&action=$1
RewriteRule ^photos/?$ /index.php?module=gallery&action=album&album=general
RewriteRule ^gallery/?$ /index.php?module=gallery&action=album&album=general
RewriteRule ^gallery/([^/\.]+)/?$ /index.php?module=gallery&action=album&album=$1
RewriteRule ^gallery/([^/\.]+)/([^/\.]+)/?$ /index.php?module=gallery&action=album&album=$1$&page=$2
RewriteRule ^gallery/([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ /index.php?module=gallery&action=item&album=$1$&page=$2&item=$3
RewriteRule ^release/?$ /index.php?module=release&action=release
RewriteRule ^error/?$ /index.php?module=error&action=error
关于如何实现这一目标的任何想法?
提前致谢!
答案 0 :(得分:1)
我认为你不能做你想做的事。
http://example.com/
中的尾部斜杠不是路径的一部分,而应该被视为分隔符,就像URL开头的斜杠一样。如果我在浏览器中输入一个没有斜杠的URL,浏览器实际上会在提交URL的GET请求之前将其附加到主机名。没有重定向。