如果索引不存在,则重定向到php页面

时间:2015-12-30 11:01:22

标签: apache .htaccess web

如果AbstractCollection不存在,是否可以(假设使用.htaccess?)自动将ArrayList重定向到public String toString() { Iterator<E> it = iterator(); if (! it.hasNext()) return "[]"; StringBuilder sb = new StringBuilder(); sb.append('['); for (;;) { E e = it.next(); sb.append(e == this ? "(this Collection)" : e); // here self calls are prevented if (! it.hasNext()) return sb.append(']').toString(); sb.append(',').append(' '); } }

但如果有blah.com/hello,我仍然希望在没有重定向的情况下显示。

1 个答案:

答案 0 :(得分:1)

尝试:

RewriteEngine on

#if /foo/index.php is not a file    
RewriteCond %{REQUEST_FILENAME}\.index.php !-f
#then redirect /foo to /foo.php
RewriteRule ^([^./]+)/?$ /$1.php [NC,L,R]