如何使用 .htaccess ReWriteEngine 将所有文件重定向到索引?
How to redirect all files to index using .htaccess ReWriteEngine?
我有一个网站,我只需要显示主页而不是实际的 URL 请求(网站正在建设中)。
该域中的任何网址都应重写为 index.html,并且只有 index.html 应该在整个网站中可见。
如何在我当前的脚本中编写规则?
注:我对搜索引擎优化的影响不感兴趣。
RewriteEngine on
# SECURITY : Directory Listing denied
options -indexes
# UTILITY : Redirect WebMail
redirect permanent /email http://www.example.com:2095/3rdparty/roundcube/index.php?
RewriteCond %{HTTP_HOST} ^example\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.example\.com$
RewriteRule ^/?$ "http\:\/\/www\.example\.com\/" [R=301,L]
重写引擎开启
重写规则 ^.+$ /index.html [L]
试试这个
我能够使用以下代码解决我的问题
RewriteCond %{REQUEST_URI} !^/index.html$
RewriteCond %{REQUEST_URI} !\.(gif|jpe?g|png|css|js|swf)$
RewriteRule .* /index.html [L,R=302]
您可以像这样拥有您的 .htaccess:
# SECURITY : Directory Listing denied
options -indexes
# by default load index.html
DirectoryIndex index.html
RewriteEngine on
# UTILITY : Redirect WebMail
RewriteRule ^email/?$ http://%{HTTP_HOST}:2095/3rdparty/roundcube/index.php? [L,R=301]
RewriteRule !^(index\.html|.+?\.(gif|jpe?g|png|css|js|swf|ico))?$ / [NC,L,R=302]
我有一个网站,我只需要显示主页而不是实际的 URL 请求(网站正在建设中)。
该域中的任何网址都应重写为 index.html,并且只有 index.html 应该在整个网站中可见。
如何在我当前的脚本中编写规则? 注:我对搜索引擎优化的影响不感兴趣。
RewriteEngine on
# SECURITY : Directory Listing denied
options -indexes
# UTILITY : Redirect WebMail
redirect permanent /email http://www.example.com:2095/3rdparty/roundcube/index.php?
RewriteCond %{HTTP_HOST} ^example\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.example\.com$
RewriteRule ^/?$ "http\:\/\/www\.example\.com\/" [R=301,L]
重写引擎开启 重写规则 ^.+$ /index.html [L]
试试这个
我能够使用以下代码解决我的问题
RewriteCond %{REQUEST_URI} !^/index.html$
RewriteCond %{REQUEST_URI} !\.(gif|jpe?g|png|css|js|swf)$
RewriteRule .* /index.html [L,R=302]
您可以像这样拥有您的 .htaccess:
# SECURITY : Directory Listing denied
options -indexes
# by default load index.html
DirectoryIndex index.html
RewriteEngine on
# UTILITY : Redirect WebMail
RewriteRule ^email/?$ http://%{HTTP_HOST}:2095/3rdparty/roundcube/index.php? [L,R=301]
RewriteRule !^(index\.html|.+?\.(gif|jpe?g|png|css|js|swf|ico))?$ / [NC,L,R=302]