Hi,
Now i have this url structure:
domain.com/news?nid=458854-Lukaku-to-italy.html
In htaccess i now want to rewrite all /news?nid= to:
domain.com/news/458854-Lukaku-to-italy.html
How do i do that?
Hi,
Now i have this url structure:
domain.com/news?nid=458854-Lukaku-to-italy.html
In htaccess i now want to rewrite all /news?nid= to:
domain.com/news/458854-Lukaku-to-italy.html
How do i do that?
Hi @thomsson and a warm welcome to the forum.
I believe the htaccess redirection is commonly called “pretty URLs” and further details can be found here:
Hi there @thomsson, welcome to the forums
What you want to use here is Apache’s RewriteEngine
Something like this:
Options -MultiViews +FollowSymlinks
RewriteEngine On
RewriteCond %{QUERY_STRING} nid=(.*?)($|&) [NC]
RewriteRule ^/?news /news/$1 [L,R=302]
Once that works (I haven’t tested it) you should replace 302 (temporary redirect) with 301 (permanent redirect).
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.