Solved

convert to SEO friendly URLs for Language code and multiple other URLs

Posted on 2014-11-27
5
133 Views
Last Modified: 2014-12-13
Hi All,

I need a help for the below URLs to convert to SEO friendly in httpd.conf.

1.  /more/in-your-language/français?languageCode=fr --> /more/in-your-language/fr ( like fr we have multiple languages)
2. /plan-and-book-your-trip/destination-guides/country-and-city-guide/individual-destinations-guides?country=Bermuda&city=null&state=null --> /plan-and-book-your-trip/destination-guides/country-and-city-guide/individual-destinations-guides/Bermuda (here as well we have multiple countries, states & cities)
3. /arrivals/Flight-details_cancelled?flightNo=BA016&flightDate=19-Nov-14&type=ARRIVAL&flight-status=Landed&terminal=5&statuscode=LD&addinfo=--  ---> /arrivals/Flight-details_cancelled/BA016 (here also there there are multiple parameters)
4. /departures/Flight-details_cancelled?flightNo=BA016&flightDate=19-Nov-14&type=ARRIVAL&flight-status=Landed&terminal=5&statuscode=LD&addinfo=--  ---> /departures/Flight-details_cancelled/BA016 (here also there there are multiple parameters)

i have tried but am getting the URLs as below
1. more/in-your-language/es - getting page not found
2. plan-and-book-your-trip/destination-guides/country-and-city-guide/individual-destinations-guides/Bermuda/null/null - null has to be hide and if i select any city or state it should append next to country.
3. arrivals/Flight-details_scheduled/BA016/19-Nov-14/ARRIVAL/Landed/5/LD/-- - here i should get only flight no, i have tride to hide the rest but am getting an exception.
4. for departures as well am getting the url starting with arrivals, because the parameter fields are same.

Please help me on these...

Thanks in advance.

Regards
Venkat
0
Comment
Question by:Srivenkata nandipati
  • 3
  • 2
5 Comments
 
LVL 29

Expert Comment

by:fibo
ID: 40470001
You are in fact dealing with 2 different related problems:
1 - generating the smart urls to be displayed on your web site
2 - redirecting all the incomig urls to the correct place in your site / program

Mod rewrites are usually associated with step 2 (making friendly urls into possibly unfriendly urls that the program can handle), while you seem in fact dealing with step 1.

Can you give us more details?
0
 

Author Comment

by:Srivenkata nandipati
ID: 40470030
Hi,

the below rules used.

1. RewriteCond %{QUERY_STRING} languageCode=(.*)
RewriteRule (.*) $1/%1? [R=301]

here am not able to hide the français/English/etc..

2.  RewriteCond %{QUERY_STRING} ^country=(.*)&city=(.*)&state=(.*) [NC]
RewriteRule ^(.*) /plan-and-book-your-trip/destination-guides/country-and-city-guides/individual-destinations-guides/%1/%2/%3? [R=301,L]
RewriteCond %{REQUEST_URI} /plan-and-book-your-trip/destination-guides/country-and-city-guides/individual-destinations-guides/(.*)
RewriteRule ^/plan-and-book-your-trip/destination-guides/country-and-city-guides/individual-destinations-guides/([a-zA-z0-9%()]+)/([a-zA-z0-9%()]+)/([a-zA-z0-9%()]+) "/localhost/plan-and-book-your-trip/destination-guides/country-and-city-guides/individual-destinations-guides?country=$1&city=$2&state=$3" [NC,PT]
RewriteRule ^/plan-and-book-your-trip/?(.*) "/localhost/plan-and-book-your-trip/$1"  [PT,QSA]

here, if select only country the url should be having only country name in the end, if state name only state name and same way for city. But with the above rules am getting country/null/null eg: .../Nigeria/null/null.

3. RewriteCond %{REQUEST_URI} ^/arrivals/(.*)
RewriteCond %{QUERY_STRING} ^flightNo=(.*)&flightDate=(.*)&type=(.*)&flight-status=(.*)&terminal=(.*)&statuscode=(.*)&addinfo=(.*) [NC]
RewriteRule ^(.*) /arrivals/Flight-details_scheduled/%1? [R=301,L]

RewriteCond %{REQUEST_URI} /arrivals/Flight-details_scheduled/(.*)
RewriteRule ^/arrivals/Flight-details_scheduled/([a-zA-z0-9%()]+) "/localhost/arrivals/Flight-details_scheduled?flightNo=$1&flightDate=$2&type=$3&flight-status=$4&terminal=$5&statuscode=$6&addinfo=$7" [NC,PT]
RewriteRule ^/arrivals/?(.*) "/localhost/arrivals/$1" [PT,QSA]

Here the url should contain only flight no, but am getting the url with all the values. Also the url may contain Flight-details_scheduled/Flight-details_cancelled/Flight-details_Diverted.

4. Here i have the same rules as Arrivals with replacing departures.

Please let me know any other details required.

Thanks in Advance.
0
 
LVL 29

Expert Comment

by:fibo
ID: 40470109
Thx.
My question and request for details is to check if you are in my scenario 1/ or scenario 2/
0
 

Author Comment

by:Srivenkata nandipati
ID: 40470214
scenario 1
0
 
LVL 29

Accepted Solution

by:
fibo earned 500 total points
ID: 40470342
If you are in the scenario 1 then the smart urls must be generated by the program which handles your site, and the mod_rewrite will in fact handle the smart urls to translate them for your program.

Do you know which program is handling your site (eg, Wordpress, Magento , etc)?
If not, you could provide us with the url of yours site, unless this creates a problem (but it would allow us to identify which program you are using)
0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A publishing tool, a Version Control System, or a Collaboration Platform! These can be some of the defining words for the two very famous web-hosting Git repositories: Bitbucket and Github. Git is widely used amongst the programmers and developers f…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This video teaches users how to migrate an existing Wordpress website to a new domain.
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to selectively show certain fields based on user input using rules to gather relevant information and data from your forms. The rules feature provides you with an opportunity…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question