.htaccess redirect non-existing pages only, keeping the token

自作多情 提交于 2021-02-11 13:00:04

问题


I want to redirect

www.domain.com/abc

to

www.domain.com/index.php?a=abc

only if the folder abc doesn't already exist. How should I write the .htaccess file?


回答1:


Try

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/(.*)$ http://www.domain.com/index.php?a=$1 [L]


来源:https://stackoverflow.com/questions/13264690/htaccess-redirect-non-existing-pages-only-keeping-the-token

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!