我有多个网址,例如domainname /भारतीय_अर्थव्यवस्था这里我只想获取数据库比较获取此类别的数据
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
答案 0 :(得分:0)
在你的.htaccess文件中,你应该有一些简单的"漂亮的网址"例如,规则(根据您自己的需要进行修改):
RewriteEngine On
RewriteRule .* db.php
然后你可以在PHP代码中获取字符串:
<?php
header ("Content-Type: text/plain; charset=UTF-8");
// Get only the path component
$data = parse_url ($_SERVER['REQUEST_URI'], PHP_URL_PATH);
// Get only the last part
$data = basename ($data);
// Handle plus sign correctly when using urldecode on the path component
$data = str_replace ("+", "%2B", $data);
// Decode
$data = urldecode ($data);
print $data;
?>