-4

Well folks want a platform that I am developing transform url visiting in a friendly url that good database for example transform

http://exemplo.pt/index.php?m=ver_estabelecimento&id=1

in

http://exemplo.pt/nome_do_estabelecimento

So we do not know how I can do this already tried some solutions on the internet but could not

I would appreciate help

CREATE TABLE IF NOT EXISTS `estabelecimentos` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `id_mae` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `titulo` varchar(250) COLLATE utf8_unicode_ci NOT NULL,
  `slug` varchar(500) COLLATE utf8_unicode_ci NOT NULL,
  `link_facebook` varchar(250) COLLATE utf8_unicode_ci NOT NULL,
  `link_mapa` text COLLATE utf8_unicode_ci NOT NULL,
  `distritos` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `concelhos` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `morada` varchar(250) COLLATE utf8_unicode_ci NOT NULL,
  `contacto` varchar(250) COLLATE utf8_unicode_ci NOT NULL,
  `int_preco` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `link_site` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `introducao` text COLLATE utf8_unicode_ci NOT NULL,
  `servicos` varchar(500) COLLATE utf8_unicode_ci NOT NULL,
  `descricao` varchar(500) COLLATE utf8_unicode_ci NOT NULL,
  `keywords` varchar(500) COLLATE utf8_unicode_ci NOT NULL,
  `keywords_pesquisa` varchar(500) COLLATE utf8_unicode_ci NOT NULL,
  `google_verification` varchar(500) COLLATE utf8_unicode_ci NOT NULL,
  `activo` tinyint(1) NOT NULL,
  `pos` bigint(20) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=111 ;

follows my structure of establishments has a slub field and the friendly url title I want to turn the the url above that and the current for that slug

Michael Berkowski
  • 267,341
  • 46
  • 444
  • 390
César Sousa
  • 101
  • 1
  • 3
  • If you want a more concrete answer, you'll have to share the code you have, and showcase some prior attempts. It's impossible for anyone to guess your database structure. – mario Jan 30 '15 at 02:18

2 Answers2

1

.htaccess file with mod_rewrite instructions is the simpliest.

Options +FollowSymLinks
RewriteEngine On

RewriteRule ^nome_do_estabelecimento$ /index.php?m=ver_estabelecimento&id=1 [L]
DeDee
  • 1,972
  • 21
  • 30
  • yes and apache but I need to pick the name you want in the url database – César Sousa Jan 30 '15 at 02:17
  • 1
    Next time please put some effort into your English before posting. In that case you need to provide a lot more information about your SQL schema, the script you run and that's gonna be too much. StackOverflow is not meant to write whole codes for people. – DeDee Jan 30 '15 at 02:24
0

this would all be performed with a .htaccess file and mod_rewrite (assuming that your webserver is apache. )

Damian Nikodem
  • 1,324
  • 10
  • 26
  • where you will stay http://exemplo.pt/nome_do_estabelecimento the nome_do_estabelecimento want you to come not from the database of this to make the apache or? – César Sousa Jan 30 '15 at 02:20
  • if you the full redirect to come from a SQL database then you could use .htaccess redirect all frontend requests to a php script which could get passed the entire URL as a parameter and then do a database lookup from there and re-serve the remaining content appropriately. – Damian Nikodem Jan 30 '15 at 02:25