Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用htaccess重写php页面_Php_.htaccess_Ftp_Rewrite - Fatal编程技术网

使用htaccess重写php页面

使用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 %

我正在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 %{REQUEST_FILENAME} !-d
RewiteRule ^([^/]+)$ ./poll.php?code=$1 [L,QSA]
如果在直接向poll.php发出请求时需要重定向浏览器:

RewriteCond %{THE_REQUEST} \ /+poll\.php\?code=([^&\ ]+)
RewriteRule ^ /%1? [L,R]

嘿,乔恩,所以我不想撒谎。我忘了我问了这个问题,但你的回答很准确。谢谢