2

Need to Modify .htaccess file so that

www.abc.com/uid?1pd47f4s4g28a3f

Should get redirected to

www.abc.com/uid.php?id=1pd47f4s4g28a3f

I tried below Codes :

#short link
Options +MultiViews
RewriteEngine on
RewriteBase /
RewriteRule ^(.+)\.php$ /$1 [R,L]
RewriteCond %uid.php -f
RewriteRule ^(.*?)/?$ /$1.php [NC,END]
0

1 Answer 1

2

Considering that you want to check if filename(from uri).php is present on local filesystem then you need to redirect request to that specific file without rewriting url in browser, if this is the case please try following.

RewriteEngine ON
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php?id=%{QUERY_STRING} [END]

NOTE: In above rules change from END to L in case you have further more rules.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.