Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.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
Php Htaccess 301重定向错误_Php_.htaccess - Fatal编程技术网

Php Htaccess 301重定向错误

Php Htaccess 301重定向错误,php,.htaccess,Php,.htaccess,如何重定向我的url,即 www.example.com/webfolder 到 example.com/webfolder/keyword 在不破坏上述内容的情况下,重新编写?根据它应该是这样的: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /webfolder/index.php/$1 [L] index.php应该在/

如何重定向我的url,即

www.example.com/webfolder

example.com/webfolder/keyword

在不破坏上述内容的情况下,重新编写?

根据它应该是这样的:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /webfolder/index.php/$1 [L]

index.php应该在
/webfolder/
中,否则会出现错误500

这里的关键字是什么?静态还是变量?是的,这是我瞄准的关键关键词。我会试试你的代码,你的回答会让我产生500个内部错误。只是想通知你。好吧,我可以考虑在未来版本中重定向,如果有的话。我将保留此线程,以便以后在必要时使用。谢谢你的支持。
RewriteEngine On
RewriteCond %{HTTP_HOST} www.example.com
RewriteRule ^webfolder/(.*) http://example.com/webfolder/$1 [L,R=301]
RewriteRule ^webfolder$ http://example.com/webfolder/ [L,R=301]


RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /webfolder/index.php/$1 [L]