url在hindi文本中重写htaccess GET URl值

时间:2016-08-02 06:01:17

标签: php .htaccess url-rewriting

我有多个网址,例如domainname /भारतीय_अर्थव्यवस्था这里我只想获取数据库比较获取此类别的数据

RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

1 个答案:

答案 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;
?>