最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

urls - How to redirect to clean links with this code

programmeradmin3浏览0评论

I have a website uses wildcard*

i made a custom page called custom-page.php

i used this code to access to this custom page

RewriteCond %{THE_REQUEST} \h/custom-page\h
RewriteCond %{REQUEST_URI} !^/custom-page\.php
RewriteCond %{HTTP_HOST} ^([^\.]+)\.domain\$
RewriteRule ^ x.php?id=%1 [L]

My problem :

this code makes this url :

subdomain.domain/custom-page

works fine and access my custom-page.php

but also when you type

subdomain.domain/custom-page.php?id=subdomain

it access too

What i Need :

what i need is when user enters this url

subdomain.domain/custom-page.php?id=subdomain

it automatics redirect him to

subdomain.domain/custom-page

how can i modify this code

发布评论

评论列表(0)

  1. 暂无评论