简体   繁体   English

htaccess删除PHP文件并从URL获取

[英]Htaccess remove php file & get from url

I'm trying to remove the php file & the get request from the URL so it looks a lot cleaner but when I load my index it just shows a blank page. 我正在尝试从URL中删除php文件和get请求,因此它看起来更整洁,但是当我加载索引时,它仅显示一个空白页面。

RewriteRule ^([^/]*)\.html$ /fetch.php?i=$1 [L]

Thats the rule i'm using so remove /fetch.php?i from the url to leave the trailing get request info. 那就是我正在使用的规则,因此/fetch.php?i从URL中删除/fetch.php?i ,以保留尾随的获取请求信息。

Example full url doamin.com/fetch.php?i=bOkU1.jpg 完整网址示例doamin.com/fetch.php?i=bOkU1.jpg

This is the basic rule to hide fetch.php from the URL. 这是从URL隐藏fetch.php的基本规则。 Put this in your root .htaccess file. 将其放在您的根.htaccess文件中。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM