NetSector
NetSector

Reputation: 106

Renaming URL with HTACCESS

I am building a web app that puts out a link like the following:

http://www.example.com/portfolio/first-name/

I would like for it to look something like this:

http://www.example.com/model/first-name/

Is this possible within the HTACCESS?

Upvotes: 0

Views: 10310

Answers (3)

Balkan Lifestyle
Balkan Lifestyle

Reputation: 72

Sure, just add an entry:

RewriteRule ^portfolio/first-name/$ /model/first-name/ [L]

I used it for my site

Upvotes: 1

devWaleed
devWaleed

Reputation: 475

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /member.php?username=$1

# /models/member.php <-- models in your case
# /users/member.php or /model/member.php
# member.php <--- Gets member name according to its ID from Database

Changes,

www.mywebsite.com/member.php?u=2343423423423423234

To

www.mywebsite.com/Username

I used it for my site :) It works fine!

Upvotes: 0

Landon
Landon

Reputation: 4108

If I understand that you want to map that first url to access the second url. Sure, just add an entry:

RewriteRule ^portfolio/first-name/$ /model/first-name/ [L]

Is that your question?

Or if you just want to map it to some php file, you can do this:

RewriteRule ^portfolio/first-name/$ /actualpage.php?param=123 [L]

Upvotes: 0

Related Questions