-2

I want to convert a the following URL

http://mughalspak.com/index.php?func=page_cms&cat_id=8&page_id=33&page_banner_image=

to

http://mughalspak.com/carriers

Faisal Riaz
  • 15
  • 1
  • 4
  • please elaborate more to get answer what are you using like framework – Santosh Ram Kunjir Mar 31 '16 at 05:38
  • on which basis above URL will convert. As there are values which creating unique url. You can use this two function- `encodeURIComponent(str)` and `encodeURI(str)`. – Rahul Mar 31 '16 at 05:43
  • Possible duplicate of [Encode URL in JavaScript?](http://stackoverflow.com/questions/332872/encode-url-in-javascript) – Rahul Mar 31 '16 at 05:45

1 Answers1

0

use htaccess Example

or you can use something below to generate friendly URL

STEPS

  1. Store all the friendly URL texts into database. Should be unique. Remove all the special characters. replace white space by underscores.
  2. use .htaccess to rewrite url, and link to a specific php file to identify the actual page.

    RewriteEngine On
    RewriteRule ^([a-zA-Z0-9-/]+)$ index.php?func=redirectpage&var=$1 [L]
    
  3. In the page.php, search database for the unique $var, Generate the link and use require()
Community
  • 1
  • 1
J.K
  • 1,382
  • 1
  • 11
  • 27