blitzen12
blitzen12

Reputation: 1390

is this possible for URL Rewrite

I know this might be a stupid question.

if I have an php or html code like this.

  <a href="http://localhost/site/author/detail.php?id=<?php $row['id']?>&name=<?php $row['name']?>">link</a>

is possible to rewrite it to something like below using htaccess?

http://localhost/site/author/(value for id here)/(value for name here)/

i've tried this.

RewriteRule ^author/(.*)$ ./author/detail.php?id=$1&name=$2

but it didnt work.

http.conf I already uncomment the module by removing #.

LoadModule rewrite_module modules/mod_rewrite.so
<Directory />
    AllowOverride none
    Require all denied
</Directory>
<Directory "C:/xampp/htdocs">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
 Require all granted
</Directory>

anyhelp would be great. Thank you.

Upvotes: 1

Views: 52

Answers (1)

anubhava
anubhava

Reputation: 785196

Place this rule in /site/author/.htaccess file:

RewriteEngine On
RewriteBase /site/author/

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)/?$ detail.php?id=$1&name=$2 [L,QSA]

Upvotes: 1

Related Questions