Solved

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

Posted on 2014-11-27
5
143 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

With more and more people tethered to the internet, advertisers can reach you in new and creative ways. Push notifications on your smartphone, customized advertisements based on your previous searches, and email inboxes filled with promotional pitch…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to choose which pages of your form are visible to your users based on their inputs. The page rules feature provides you with an opportunity to create if:then statements for y…
Learn how to set-up custom confirmation messages to users who complete your Wufoo form. Include inputs from fields in your form, webpage redirects, and more with Wufoo’s confirmation options.

734 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