Php htaccess重写字母和数字符号
我想传递url参数,如Php htaccess重写字母和数字符号,php,regex,.htaccess,Php,Regex,.htaccess,我想传递url参数,如example.com/username或example.com/myemail@gmail.com如果有人从表中选择,我想匹配两个条件? 这是我的.htaccess代码 # Default index page DirectoryIndex index.php # Remove file extensions RewriteCond %{REQUEST_FILENAME} !-f RewriteEngine on RewriteCond %{REQUES
example.com/username
或example.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
你现在有什么错误吗?你的问题完全不清楚。哪两个条件?在重写上下文中,“从表中选择”是什么意思?为什么首先
RewriteCond
,然后RewriteEngine on
?如果我理解您的意图,您可能还想查看一下,您可以从example.com/abc first/abc.php和/index.php中获得。然而,example.com/abc@def.gh将被重新连接到/abc@def.gh.php,因为第二条规则只接受字母、数字、下划线和连字符。