Solved

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

Posted on 2014-11-27
5
122 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

If I have to fix slow responding website my first thoughts are server side optimizations: the database may not be optimized or caching is not enabled, or things like that. We often overlook another major part of our web application: the client. We o…
Read about how to approach blogging and about ways to do it right. Stand out from the crowd and let your knowledge be consumed by a large audience. This article aims to explain how your blog should look like,  the most important things to do while b…
This video teaches users how to migrate an existing Wordpress website to a new domain.
Wufoo.com provides powerful tools for surveying targeted groups, and utilizing data from completed surveys to find trends, discover areas of demand or customer expectation, and make business decisions on products or services.

743 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now