prgos
prgos

Reputation: 3

.htaccess rewrite rule for specific URL

When user hit a URL like this

www.mydomain.com/premium-pro/somepage.html

It should map to the www.mydomain.com/myfile.php

and I should be able to access somepage.html as a $_GET parameter in myfile.php

I have .htaccess under mydomain.com but very new to rewrite rules and not sure what kind of rule should be written there. I did research on this but didn't get succeed. Please help

Upvotes: 0

Views: 40

Answers (2)

Abhishek Gurjar
Abhishek Gurjar

Reputation: 7476

Try with below rule in root, I've taken a var variable for $_GET data.

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_URI} ^/premium-pro/(.+)
RewriteRule ^ myfile.php?var=%1 [L]

Upvotes: 1

Karbust
Karbust

Reputation: 67

Try this:

Options +FollowSymLinks
RewriteEngine On

RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f

RewriteRule myfile.php ./premium-pro/somepage.html

Upvotes: 0

Related Questions