htaccess重写字母数字和符号

时间:2017-03-28 11:29:19

标签: php regex .htaccess

我想传递一个url参数,例如example.com/usernameexample.com/myemail@gmail.com我想匹配两个条件,如果有人从表中选择是真的吗? 这是我的.htaccess代码

 # Default index page
 DirectoryIndex index.php


 # Remove file extensions
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteEngine on

 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteCond %{REQUEST_FILENAME}\.php -f
 RewriteRule ^(.*)$ $1.php

 # Display a custom error message
 #ErrorDocument 404 http://localhost//
 #ErrorDocument 500 http://localhost//

 #ErrorDocument 404  404
 #ErrorDocument 500  500
 #Profile rewrite
 RewriteRule ^([a-zA-Z0-9_-]+)$ index.php?ref=$1

0 个答案:

没有答案