网址重写问题没有解决

时间:2016-03-08 12:09:07

标签: php .htaccess

我已经做了很多学习以学习htaccess,但没有什么适合头脑(不知道为什么)。做了相当搜索/谷歌搜索解决这个问题,但没有任何结果,因此考虑一次性活动在这里发布。

我有这个动态网址(修复参数计数),它根据用户输入不断变化:

http://domain.com/Results.php?keyword=+Operations%2C+Facility%2C+Sales%2C+Strategy%2C+MIS%2C++Analytics%2C+&Location=Delhi%2C+Noida%2C+Gurgaon%2C+&exp=6&functional_area=1004&Industry=10008&salary=118&Search_jobs=Search+Jobs

我想将此动态网址更改为以下内容:

http://domain.com/Operations-Facility-Sales-Strategy-MIS-Analytics-in-Delhi-Noida-Gurgaon
谷歌搜索时我发现this_url删除了所有逗号,空格等,但考虑到我需要满足的以下条件,并没有达到目的。

条件:

  1. Results.php应该可以访问原始网址查询字符串 脚本
  2. 根据SEO指南,网址长度应该短/正确
  3. 如果有多个空格,请将其修剪为一个空格
  4. 仅显示关键字和位置名称的重写网址
  5. 所有其他文件/脚本不应受修订后的网址
  6. 影响

    修改

    我曾使用上面提到的链接htaccess到我的服务器&设法实现以下(我目前的网址)

    Options +FollowSymlinks -MultiViews
    RewriteEngine On
    RewriteBase /
    
    # replace all comma by hyphen
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+(.*?)(?:,|%2C)+(.+?)\sHTTP [NC]
    RewriteRule ^ %1-%2 [L,NE,R=302]
    
    # replace all space by hyphen
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+(.*?)(?:\+|%20|\s)+(.+?)\sHTTP 
    [NC]
    RewriteRule ^ %1-%2 [L,NE,R=302]
    
    # tried this one to achieve some result but not worked
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^([0-9a-zA-Z]+)/([a-zA-Z]+)/([0-9a-zA-Z]+)/([a-zA-Z]+)/([a-
    zA-Z]+)/([0-9a-zA-Z]+)/([a-zA-Z]+)?.php$ Results.php?keyword=$1&
    Location=$2&exp=$2&functional_area=$4&Industry=$5&salary=$6&
    Search_jobs=$7 [L,QSA]
    

    现在的问题是删除所有查询字符串&仅附加修改后的网址"关键字"和"位置" params实现以下结果。任何帮助。

    我当前的网址

    http://domain.com/Results.php?keyword=Operation-Manager-FACILITY-MANAGER-
    3D-Animator-and-Compositor&Location=Rest-Andaman-Nicobar-Rest-Andhra-
    Pradesh-Delhi-NCR&exp=&functional_area=&Industry=&salary=&
    Search_jobs=Search-Jobs
    

    必填网址

    http://domain.com/Operation-Manager-FACILITY-MANAGER-3D-Animator-
    and-Compositor-in-Rest-Andaman-Nicobar-Rest-Andhra-
    Pradesh-Delhi-NCR
    

0 个答案:

没有答案