Jump to content

Urgent : mod_rewrite help for redirecting url as cityname.maindomain.com


rishibala143

Recommended Posts

Hi

 

I am new to mod_rewrite

 

I need two things to do in htacess

 

1. I want all my php pages to display as html

 

  Example : index.php to index.html

        aboutus.php to aboutus.html

 

  I given like this

 

Options +FollowSymLinks

RewriteEngine on

RewriteRule ^([^/]*)\.html$ index.php?action=$1

RewriteRule ^([^/]*)\.html$ aboutus.php?action=$1

 

This works good. But for this a query string is passes. I don’t want to give any query string. If I click index.php it should redirect to index.html. I don’t want to write separate for aboutus.php. within a single code it should redirect all php to html pages

 

 

2. The most wanted thing

 

I want to search a thing using city name in my project

 

For example

 

If I click the cityname eg.chennai

 

The following url will be like this : www.domainname.com/search.php?city=chennai

 

But I want like this

 

http://chennai.domainname.com

 

if I click Mumbai it should be http://mumbai.domainname.com

 

How to do this ?

 

I want like this site

 

http://www.clickindia.com/

http://www.indialist.com

 

There if we click the city name it will redirect the url as cityname.domainname.com

 

Please help

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.