Regarding htaccess file

software development

#1

Dear Friends,
I need one help urgently.
http://audio.iskcondesiretree.info/index.php?q=f&f=/05_-_ISKCON_Chowpatty
This is the url but i want to display url friendly manner so that it can be google search friend;ly can any body will be help how i can write htaccess file so that it can help me and where to put that htaccess file.

I would be very grateful for your help.

Thanks in advance.


#2

you’re going to need mod_rewrite, but that’s about all i can tell you until you tell me what you want the url to look like to visitors and search engines and which parts of the actual url you expect to change and how.

track7 - my dream-hosted site


#3

Thank you for your reply.We have one website iskcondesiretree.info in that there is many subdomains such as audio.iskcondesiretree.info.For confirmation you can visit the websites.Now you click on any folder in that audio.iskcondesiretree.info it will appear in address bar like that http://audio.iskcondesiretree.info/index.php?q=f&f=/03_-_ISKCON_Prabhujis. But i wwant it to be without ? mark and user friendly same as clean url functionality in drupal.So that it can user friendly.I hope it must be clear to you now.I want same address to appear like http://audio.iskcondesiretree.info/ISKCONPrabhujis. Like that.

Kindly help me what should i do and where to put that code. or any if you have any other idea how can we can write the url address in proper way in address bar so that it should user friendly and google search engine.Something is known as url rewriting.


#4

is this the only type of url you would have on the audio subdomain? you’re going to need something that separates the ISKCON and Prabhujis parts as well as the 03 to be in there somewhere. assuming all urls on the audio subdomain look like /index.php?q=f&f=/[number]-[name]_[title] you can do something like this:

RewriteEngine on
RewriteRule ^([0-9]+)/([^/]+)/([^/]+)$ /index.php?q=f&f=/$1_-$2$3

which would work if you link to http://audio.iskcondesiretree.info/03/ISKCON/Prabhujis

you could get even simpler if you use a url like http://audio.iskcondesiretree.info/03_-_ISKCON_Prabhujis which would use rules like this:

RewriteEngine on
RewriteRule ^(.+)$ /index.php?q=f&f=/$1

searching for apache mod_rewrite will probably give you a lot of general results about how this all works. here’s the mod_rewrite info from the apache site: http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html

also since RewriteRule works on a regular expression you might want to learn about regular expressions if you aren’t already familiar.

track7 - my dream-hosted site


#5

Thank you very mush for youe help.
http://audio.iskcondesiretree.info/03/ISKCON/Prabhujis this is working.But problem with this is that when i click on this it gives error it does open audio file inside that.It would be kind of you if you audio.iskcondesiretree.info and see the website structure accordingly guide me and give me the code.morever is it possible to represent wesbite address like this. it will more user friendly.
http://audio.iskcondesiretree.info/ISKCONPrabhujis

I would be very grateful to you for you kind help.


#6

This is not a simple undertaking. For the URL rewriting as you’ve noticed one needs to look at the URLs for your site to understand the patterns in order to come up with a good set of rules. But its even more complicated than that because the script that generates the HTML pages will also need to be modified as a result. Someone will need to fix it to use absolute URLs for the images and JavaScript files.

Customer since 2000 :cool: openvein.org


#7

Dear Friend

I am in urgent need of this .if you wish i can send you the the php script that we are using you can modify that.Basically it reads directory and disply them or if you have any php script that reads directory but in address bar it displays as google serach engine.I am sorry to bother you.

Thank you very much for your help.


#8

[quote]if you have any php script that reads directory but in address bar it displays as google serach engine

[/quote]

No, you can’t do that. Barring a serious bug in the web browser, the address bar will always display the address of your site. Why on earth would you want it to display as something else?


#9

I don’t think that is what kanhaiya09 meant; their script obviously takes a path in a query string parameter to scan it for directories or media files. Now they want to hop on the bandwagon and eliminate query strings. So now what is desired is either to modify the script they are using or switch to a different one where “Human Friendly” URLs are supported already.

kanhaiya09 you do not need “Human Friendly” URLs to make your site so-called search engine friendly. The people that run search engines already know how the Web works and have no problem indexing pages at URLs with query strings. For example here is your site at Google.

Customer since 2000 :cool: openvein.org