使用htaccess重写php页面
我正在poll.php?code=STRINGHERE创建一个表单 我想用.htaccess to do WEBSITE.com/STRINGHERE重写它 我以前做过,但不记得我需要在。htaccess中做什么使用htaccess重写php页面,php,.htaccess,ftp,rewrite,Php,.htaccess,Ftp,Rewrite,我正在poll.php?code=STRINGHERE创建一个表单 我想用.htaccess to do WEBSITE.com/STRINGHERE重写它 我以前做过,但不记得我需要在。htaccess中做什么 RewriteEngine On RewiteRule ^(\w.+)$ ./poll.php?code=$1 虽然我可能错了。任何帮助都很好。试试: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %
RewriteEngine On
RewiteRule ^(\w.+)$ ./poll.php?code=$1
虽然我可能错了。任何帮助都很好。试试:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewiteRule ^([^/]+)$ ./poll.php?code=$1 [L,QSA]
如果在直接向poll.php发出请求时需要重定向浏览器:
RewriteCond %{THE_REQUEST} \ /+poll\.php\?code=([^&\ ]+)
RewriteRule ^ /%1? [L,R]
嘿,乔恩,所以我不想撒谎。我忘了我问了这个问题,但你的回答很准确。谢谢