RewriteRule 重定向整个域以获取参数
RewriteRule to redirect whole domain to get parameter
我想用 .htaccess[=16= 中的重写规则将 整个 url 重定向到 查询参数 ]
例如:http://server.com/http://google.com
应该重定向到
http://server.com/index.php?url=http://google.com
到目前为止我只能完成这项工作:http://server.com/google.com
但是当包含 :
或 /
时,它不起作用..
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^([a-z0-9_.-]+)$ index.php?url= [L,NC,QSA]
感谢帮助!
RewriteRule
模式将多个 /
剥离为一个,最好在此处使用 RewriteCond
:
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/(.+)$
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule . index.php?url=%1 [L,NC,QSA]
为什么不直接执行 TLD
,然后在规则中添加 http://
。我就是这样做的。
这是我使用它的方式,所以它不会 "look" 无效。 http://server.com/google.com
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^([a-z0-9_.-]+)$ index.php?url=http:// [L,NC,QSA]
我想用 .htaccess[=16= 中的重写规则将 整个 url 重定向到 查询参数 ]
例如:http://server.com/http://google.com
应该重定向到
http://server.com/index.php?url=http://google.com
到目前为止我只能完成这项工作:http://server.com/google.com
但是当包含 :
或 /
时,它不起作用..
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^([a-z0-9_.-]+)$ index.php?url= [L,NC,QSA]
感谢帮助!
RewriteRule
模式将多个 /
剥离为一个,最好在此处使用 RewriteCond
:
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/(.+)$
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule . index.php?url=%1 [L,NC,QSA]
为什么不直接执行 TLD
,然后在规则中添加 http://
。我就是这样做的。
这是我使用它的方式,所以它不会 "look" 无效。 http://server.com/google.com
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^([a-z0-9_.-]+)$ index.php?url=http:// [L,NC,QSA]