Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 161
  • Last Modified:

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

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
Srivenkata nandipati
Asked:
Srivenkata nandipati
  • 3
  • 2
1 Solution
 
fiboCommented:
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
 
Srivenkata nandipatiAuthor Commented:
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
 
fiboCommented:
Thx.
My question and request for details is to check if you are in my scenario 1/ or scenario 2/
0
 
Srivenkata nandipatiAuthor Commented:
scenario 1
0
 
fiboCommented:
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

Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now