| | #1 |
| HyperActive Warrior Join Date: 2011 Location: India
Posts: 165
Thanks: 65
Thanked 4 Times in 4 Posts
|
Hello Warriors, I really need help please. I need to redirect this URL using htacess: From this: http ://example.com/city/Chennai/search/search_display_event_type/category1 To this: http ://example.com/chennai/category1 Is there any way we can write in htacees that will redirect like below url http ://example.com/(chennai | pune | mumbai)/category1 I know this is pretty hard, but I'm really not sure what type of rule would work for this. because I dont want to write same lines of code for just city change, so i want something like array match in htaccess. Any help is greatly appreciated! |
| Real Youtube & Instagram Promotion Click Here | |
| |
| | #2 |
| Scrum project management Join Date: 2014 Location: France
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
Hello jhakasseo, Please follow this url to make your changes How do I redirect my site using a .htaccess file? |
| | |
| |
| | #3 |
| Active Warrior Join Date: 2014
Posts: 38
Thanks: 0
Thanked 6 Times in 6 Posts
|
Using something like this in your .htaccess. Code: Options +FollowSymLinks RewriteEngine On RewriteRule ^city/(.*)/search/search_display_event_type/(.*)$ http://example.com/$1/$2 [R=301,L] |
| |
| The Following User Says Thank You to Kasparas For This Useful Post: |
| | #4 | |
| HyperActive Warrior Join Date: 2011 Location: India
Posts: 165
Thanks: 65
Thanked 4 Times in 4 Posts
|
dynamic redirection - Pastebin.com on website there are more than 3000 urls that need to change from old to new. so I am looking any dynamic solution for same. Every city has 19 category pages. so city + category 1, city + category 2 and the list goes on... I want to redirect old urls to new one. Or what will be the best way to do this? | |
| Real Youtube & Instagram Promotion Click Here | ||
| |
| | #5 | |
| Active Warrior Join Date: 2014 Location: Austria, Vienna
Posts: 52
Thanks: 16
Thanked 10 Times in 10 Posts
|
You can remove the piece of code in line 3 and 4 and replace it with the RewriteRule above. It is dynamic. If you want to use 301 permanent redirect, this is not for idividual urls on a website. you only write one 301 for the entire website which will then redirect to a new domain. Code: Options +FollowSymLinks RewriteEngine On RewriteRule ^city/(.*)/search/search_display_event_type/(.*)$ http://example.com/$1/$2 [R=301,L] Code: http://example.com Hope that helps Mike | |
| |
| The Following User Says Thank You to minirich For This Useful Post: |
| | #6 |
| HyperActive Warrior Join Date: 2011 Location: India
Posts: 165
Thanks: 65
Thanked 4 Times in 4 Posts
|
@minirich RewriteEngine on RewriteRule ^city/(.*)$/search/search_display_event_type/(.*)$ http://www.example.org/$1/$2 [R=301,L] this is not working and it is going to 404 page? |
| Real Youtube & Instagram Promotion Click Here | |
| |
| | #7 |
| Active Warrior Join Date: 2014 Location: Austria, Vienna
Posts: 52
Thanks: 16
Thanked 10 Times in 10 Posts
|
Have you tried to remove the http part and starting with a / Like that: Code: RewriteRule ^city/(.*)$/search/search_display_event_type/(.*)$ /$1/$2 [R=301,L] |
| |
| The Following User Says Thank You to minirich For This Useful Post: |
| | #8 | |
| HyperActive Warrior Join Date: 2011 Location: India
Posts: 165
Thanks: 65
Thanked 4 Times in 4 Posts
|
Code: RewriteRule ^city/(.*)$/search/search_display_event_type/meeting(.*)$ /$1/$2 [R=301,L] To RewriteRule ^city/city1|city|2|city3(.*)$/search/search_display_event_type/meeting-rooms(.*)$ /$1/$2 [R=301,L] We are directing for search engines because there are so many webpages got indexed and want them to redirect to example.org this kind of urls. | |
| Real Youtube & Instagram Promotion Click Here | ||
| |
| | #9 |
| Active Warrior Join Date: 2014 Location: Austria, Vienna
Posts: 52
Thanks: 16
Thanked 10 Times in 10 Posts
|
Ok i had a look on the page and all the possible url combinations. This is a bit more complicated than you told in the beginning. the structure of your urls look like that: Code: http://example.com/city/(city)/search/search_display_event_type/(Category)/(Location)/(Capacity)/(Configuration) Category is one of these: Wedding+Reception, Meetings, Conference, Brithday-Party, Private-Party Location: depends on the city and can be a whole lot to choose from Capacity: a range in the form of low-high Configuration: the arrangement of the seating can be one of 7 (Conference-Style, U-Shape, Holow-Square-style, Theater-style, Classroom-style, open, cluster) while city and category are mandatory to see any result, Location, Capacity and Configuration are optional but will appear in a specific order. The following rules will be the result: the order is important. Code: RewriteBase / # just the city RewriteRule ^(.*)$ /city/$1 [NC, L] # city with category RewriteRule ^(.*)/(.*)$ /city/$1/search/search_display_event/$2 [NC, L] # city with category and Configuration RewriteRule ^(.*)/(.*)/(Conference-Style|U-shape|Holow-square-style|Theater-style|Classroom-style|Open|Cluster)$ /city/$1/search/search_display_event/$2/$3 [NC,L] # city with category and Capacity RewriteRule ^(.*)/(.*)/([d]+-[d]+)$ /city/$1/search/search_display_event/$2/$3 [NC,L] # city with category and location RewriteRule ^(.*)/(.*)/([D-]*)$ /city/$1/search/search_display_event/$2/$3 [NC,L] # city with category Location and Configuration RewriteRule ^(.*)/(.*)/([D-]*)/(Conference-Style|U-shape|Holow-square-style|Theater-style|Classroom-style|Open|Cluster)$ /city/$1/search/search_display_event/$2/$3/$4 [NC,L] # city with category capacity and configuration RewriteRule ^(.*)/(.*)/([d]+-[d]+)/(Conference-Style|U-shape|Holow-square-style|Theater-style|Classroom-style|Open|Cluster)$ /city/$1/search/search_display_event/$2/$3/$4 [NC,L] # city with category location and capacity RewriteRule ^(.*)/(.*)/([D-]*)/([d]+-[d]+)$ /city/$1/search/search_display_event/$2/$3/$4 [NC,L] # city with category location capacity and configuration RewriteRule ^(.*)/(.*)/([D-]*)/([d]+-[d]+)/(Conference-Style|U-shape|Holow-square-style|Theater-style|Classroom-style|Open|Cluster)$ /city/$1/search/search_display_event/$2/$3/$4/$5 [NC,L] Code: http://example.com/Mumbai http://example.com/Mumbai/Meetings http://example.com/Mumbai/Meetings/Cluster http://example.com/Mumbai/Meetings/1-500 http://example.com/Mumbai/Meetings/Dadar http://example.com/Mumbai/Meetings/Dadar/Cluster http://example.com/Mumbai/Meetings/Dadar/1-500 http://example.com/Mumbai/Meetings/1-500/Cluster http://example.com/Mumbai/Meetings/Dadar/1-500/Cluster And if some one out there knows a way to optimize this feel free to comment. Hope that helps Mike |
| |
| The Following User Says Thank You to minirich For This Useful Post: |
| | #10 | |
| HyperActive Warrior Join Date: 2011 Location: India
Posts: 165
Thanks: 65
Thanked 4 Times in 4 Posts
|
Thank you very much for taking time to see website and replying. I really appreciate. The one thing that I also forget to add that the category like meetings etc going to change from meetings to meeting-halls, from wedding+reception to wedding-reception-halls etc. So this is also I want to add in htaccess with above mention solution. Need help on this actually. The actual urls look likes as below with all lowercase letters. Code: http://www.example.com/mumbai http://www.example.com/mumbai/meeting-halls http://www.example.com/mumbai/meeting-halls/cluster http://www.example.com/mumbai/meeting-halls/1-500 http://www.example.com/mumbai/meeting-halls/dadar http://www.example.com/mumbai/meeting-halls/dadar/cluster http://www.example.com/mumbai/meeting-halls/dadar/1-500 http://www.example.com/mumbai/meeting-halls/1-500/cluster http://www.example.com/mumbai/meeting-halls/dadar/1-500/cluster | |
| Real Youtube & Instagram Promotion Click Here | ||
| |
| | #11 |
| Active Warrior Join Date: 2014 Location: Austria, Vienna
Posts: 52
Thanks: 16
Thanked 10 Times in 10 Posts
|
It should work for any kind of category. The rules contain a regular expression (.*) this will match every character. The only thing which needs to be changed is if you change to configuration values. (Conference-Style|U-shape|Holow-square-style|Theater-style|Classroom-style|Open|Cluster) if you have your new configuration names. just search the old name and replace it with the new name. Just send me a pm or skype me when you need help there too. Mike |
| |
| The Following User Says Thank You to minirich For This Useful Post: |
| | #12 | ||
| HyperActive Warrior Join Date: 2011 Location: India
Posts: 165
Thanks: 65
Thanked 4 Times in 4 Posts
|
How to identify and put non match query to get it redirect. | ||
| Real Youtube & Instagram Promotion Click Here | |||
| |
| | #13 |
| Active Warrior Join Date: 2014 Location: Austria, Vienna
Posts: 52
Thanks: 16
Thanked 10 Times in 10 Posts
|
If it is not possible to use the values directly in the redirect we have to use a rewrite mapping. The problem i have is, i'm the next 8 to 10 days offline. If you need it really urgent i will try to do it today. But i need a list of the values and to what they should be mapped to. Mike |
| |
| The Following User Says Thank You to minirich For This Useful Post: |
| | #14 | |
| HyperActive Warrior Join Date: 2011 Location: India
Posts: 165
Thanks: 65
Thanked 4 Times in 4 Posts
|
![]() Now I want to redirect from http:// xyz.com/city/Pune/welcome/venue_display/Abc-Xyz/Locality to http:// www. xyz.com/pune/abc-xyz/locality I want some part of url in lowercase example: (Abc-Xyz/Locality to abc-xyz/locality) So is there any rewrite rule or anything that I want to mention in htaccess for this specific? | |
| Real Youtube & Instagram Promotion Click Here | ||
| |
| | #15 |
| Active Warrior Join Date: 2014 Location: Austria, Vienna
Posts: 52
Thanks: 16
Thanked 10 Times in 10 Posts
|
Hi, sorry for answering now, i extended the vacation, because my wife and kids wanted to burry their feet in the beach sand for another week. There is a way to sort the uppercase problem in the redirect rules, but i have to research it a bit, because currently i belive it is only working in the virtual host configuration. Have you got the list for the category substitutions (meeting -> meeting-halls) ready, i will try to fix this in one big swoop. Mike |
| Last edited on 12th Aug 2014 at 02:25 AM. Reason: typo | |
| |
| The Following User Says Thank You to minirich For This Useful Post: |
| | #16 | |
| HyperActive Warrior Join Date: 2011 Location: India
Posts: 165
Thanks: 65
Thanked 4 Times in 4 Posts
|
Yeah good to see you back.. Finally I found the way to solve all issues with combination of htaccess and config file from hosting. Redirected all old urls to new with lowercase. So many thanks to you bro.. | |
| Real Youtube & Instagram Promotion Click Here | ||
| |
| | #17 |
| Active Warrior Join Date: 2014 Location: Austria, Vienna
Posts: 52
Thanks: 16
Thanked 10 Times in 10 Posts
|
Great, so your happy? Mike |
| |
|
| Bookmarks |
| Tags |
| dynamic, htaccess, redirection, url |
| |