Hi, it is possible change this URL with .htaccess?
From https://www.example.it/news.php?slug=aaaa-bbb-ccccc
To ( seo-friendly without ‘news’ ): https://www.example.it/ aaaa-bbb-ccccc
Adolfo_1
0
Light Poster
Recommended Answers
Jump to PostJust to understand what you are asking. Do you want when somebody visits https://www.example.it/news.php?slug=aaaa-bbb-ccccc to redirected automatically through .htaccess rules to https://www.example.it/aaaa-bbb-ccccc with 301 Moved Permanently status code , and when you have a visit to https://www.example.it/aaaa-bbb-ccccc to have your server …
Jump to PostYour .htaccess file would look something like:
RewriteEngine On RewriteRule ^([a-z]+)-([a-z]+)-([a-z]+)$ news.php?slug=$1-$2-$3 [L]
This is untested, but it should work.
All 5 Replies
jkon
602
Posting Whiz in Training
Featured Poster
Adolfo_1
commented:
I also have category and publisher http://localhost/example/category.php?slug=lex but they all contain news
+1
Dani
4,084
The Queen of DaniWeb
Administrator
Featured Poster
Premium Member
Adolfo_1
commented:
As jkon Thanks In localhost it gives me URL: http://localhost/example/news/aaaa-bbb-ccccc And The requested URL was not found on this server.
+1
jkon
602
Posting Whiz in Training
Featured Poster
Adolfo_1
commented:
Thanks In localhost it gives me URL: http://localhost/example/news/aaaa-bbb-ccccc And The requested URL was not found on this server.
+0
jkon
602
Posting Whiz in Training
Featured Poster
jkon
602
Posting Whiz in Training
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.