简体   繁体   中英

How to Write a rewrite rule in my sub directory htaccess file to achieve this

I have a sub directory named as "apps" under my public html folder.I fetch "apps" database table records and show some of the records on index.php file and give a link to another file to show more records for the particular row. I have another file named "details.php" in the same directory where i show full records of selected row.

my link looks like this

<a href="details.php?
name=APP_NAME">APP NAME 
</a>

where APP_NAME is unique in database table.

suppose i have an app named "oreo" in my db then the link look like

<a href="details.php?
name=oreo">oreo 
</a>

I want rewrite this url to make it seo friendly like this

<a href="oreo">oreo 
</a>

and full url will look like this

https://example.com/apps/oreo

I have tried this code,but it's not working

RewriteRule ^/apps/(.*)$ 
/details.php?name=$1  

I don't have much clarity on Rewrite Rule..So I need help..

got it.It works

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /apps/details.php?name=$1

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