osiic21
osiic21

Reputation: 149

Canonical url htaccess

I am trying to achieve certain thing via htaccess file. I would like this

http://mypage.com/e-store/561/ http://mypage.com/e-store/562/

to look like this

http://mypage.com/tv-screens http://mypage.com/computers

I have read that it is possible via htaccess with rewrite urls. But I cant manage to wrap my head around it.

Upvotes: 1

Views: 951

Answers (1)

Dmitrii Maslennikov
Dmitrii Maslennikov

Reputation: 338

Use this is .htaccess file:

RewriteRule ^([-a-zA-Z0-9_]+)/$ ?url=$1 [L]

And add in your code output pages as:

http://mypage.com/?url=tv-screens

Where on the parameter URL the necessary page is displayed.

This link doesn't display page screen name:

http://mypage.com/e-store/561/

Upvotes: 1

Related Questions