简体   繁体   中英

Subfolders Url rewriting using htaccess

i am working within sub folder of my website and i want to rewrite my urls.

i have never done this before nor have any knowledge of rewriting rules.

I have a file which named show.php which takes parameter id which is any no and then it echo that no on to the screen.

Now this file is in folder name polo.

    www.xyz.com/polo/show.php

i want to rewrite

    www.xyz.com/polo/show.php?id=10

to

    www.xyz.com/polo/id/10

I tried this answer but still its not working.

Subfolders using htaccess

Any help would be appreciated.

Enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory:

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteRule ^(polo)/(id)/([0-9]+)/?$ /$1/show.php?$2=$3 [L,QSA,NC]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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