.htaccess RewriteRule Query String - .htaccess

Firstly thanks for the support and sorry but I am new to RewriteRule.
I have the following url:
https://www.example.com/jobs/?job_title=&specialisms=&location=&radius=200&cs_=&cs_=Find+Job
which I want to make into :
https://www.example.com/(job_title)-jobs/in-(specialisms)/in-(location)
any help would be great.

Related

htaccess from old forum url to new one

until now I have always used htaccess to rewrite URLS in order to have non-SEF url to SEF urls.
Today I am facing a new challenge that honestly, beeing non confident in regular expression, I really don't know how to achieve.
I have a situation where a forum on a website of mine has been update in the following form:
previous link: www.domain.com/forum3/topic/name-of-topic/post/7548
new link: forum.domain.com/Topic-name-of-topic/
How do I intercept /post/37764 string and tell htaccess to not consider it?
And how to instruct the server to build that kind of url instead of the provious. I am very confused about it.
Any suggestion? Thank you very much. Is there any resource that I can read to help me better understand the case?
Thanks again.
EDIT
Florian answer is correct. I just added few mods to fit it better.
RewriteEngine On
#RewriteBase /
RewriteRule ^forum3/topic/([^/]+)/post/[0-9]+$ http://forum.domanin.com/Topic-$1/ [L,R=301]
RewriteRule ^forum3/topic/([^/]+)-[0-9]+$ http://forum.domanin.com/Topic-$1/ [L,R=301]
You can try this code :
RewriteEngine On
RewriteBase /
RewriteRule ^forum3/topic/([^/]+)/post/[0-9]+$ /Topic-$1/ [L,R=301]
/([^/]+)/ means that we want to catch a string containing one or more characters except / preceded and followed by a /.
This link might help you to test your .htaccess files :
Test your apache htaccess files online

htaccess file help needed for rewriting url

I need help from experts to solve my problem. I'm just starting to learn rewriterule, rbase, and rcond. I want to rewrite my site link like codeigniter MVC. For example:
http://localhost/app/index.php?page=profile&user=john -> http://localhost/app/index/page/profile/user/john
How to do that? I tried to change for many times, but i don't get url like that but error occured.
RewriteRule ^index/page/(.*)/user/(.*)$ /index.php?page=$1&user=$2 [L]

Rewrite URL case

I have the following URL: http://sitename.com/?parameter_1=data&parameter_2=data
it always remains the same with the same data. I want it to be converted into the following URL: http://sitename.com/most-popular
I believe it is quite simple to do it from .htaccess but I am not familiar with rewrite rules.
Thank you.
If I correctly understand what you mean, you could try this
RewriteRule ^most-popular/?$ ?parameter_1=data&parameter_2=data [L]

this is url rewrite is not working

i tried to create this url rule buts not working: i dont know why :(
orginal url
www.example.com/viewprofile.php?username=jhon
the desired friendly url is
www.example.com/user/jhon
this is my.htaccess code:
RewriteEngine On
RewriteRule ^username/([^/]*)$ /viewprofile.php?username=$1 [L]
thanks for helping!! :))
I found this tutorial where the author explain step by step how to do exactly what you are trying to do. See if it helps: http://www.emanueleferonato.com/2008/06/15/how-to-generate-friendly-urls-with-htaccess-part-2/

How to beautify the URL?

I am sick of this kind of URL:
www.domain.com/something/?id=person&photos=photoID&variable1=others&...
I am using apache, learning to write .htaccess now. Can anyone show me the basic code for this one?
Ugly:
www.domain.com/something/?id=person&photos=photoID
Goal:
www.domain.com/something/person/photoID
RewriteEngine on
RewriteRule ^something/(.*)/(.*)$ something/?id=$1&photos=$2 [QSA]
This is an extremely helpful article on Mod_Rewrite

Resources