Htaccess url rewrite help please

Started on the old forum in November 2011 · view the original in the archive · old links redirect here

8 replies · 551 views · started 15 years ago · 1 min read

4 participants
Sifat3d Developer · 66 posts #1

My pages have urls like:

cows.com/?go=cowdung

i want to use htaccess and in such a way that, when a user types into his/her web browser :

cows.com/cowdung

htaccess uses the mod-rewrite(rewriterule) and takes the user to:

cows.com/?go=cowdung

CAN THIS BE DONE? if yes, then please someone write me the htaccess code please. I have no idea how to use the htaccess. Please help.Just in case:"the cows.com domain does NOT BELONG to me, i just used it as an example." Thanks in advance.:-)

Added after 8 minutes:

And it cant just be for

cows.com/cowdung

becomes>>

cows.com/?go=cowdung

it has to work for any value.like

cows.com/anything

becomes>>

cows.com/?go=anything

CAN THIS BE DONE? if yes, then please someone write me the htaccess code please.

Fake hack any website,even coding-talk for some clean FUN!!! Try: fake hacking website Mig33 Software for pc: Mig33 for PC mobile games and software download

subzero Super moderator Fellow · 3,954 posts #2

Rewrite cows.com/(.*)^ $cows.com/$1

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

Sifat3d Developer · 66 posts #3

Int. Server error

Doesnt work:-(

Rewrite cows.com/(.*)^
$cows.com/$1

My whole site becomes unavailable and says: 500 internal server error. The server encountered an internal error or misconfig . . . . . . My server is Apache-1.3.27 is this due to the backdated server?

Fake hack any website,even coding-talk for some clean FUN!!! Try: fake hacking website Mig33 Software for pc: Mig33 for PC mobile games and software download

subzero Super moderator Fellow · 3,954 posts #4

RewriteCond %{HTTP_HOST} !^www.example.com [NC] RewriteCond %{HTTP_HOST} !^$ RewriteRule ^/(.*) http://www.example.com/$1 [L,R]

Try this one

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

razzbee Developer · 130 posts #5

There should be something after the cow.com like example : cow.com/cowdung => cow.com/page.php?go=cowdung

RewriteRule ^cow\.com\/(.+)$ /page.php?go=$1 [L,NC,QSA]

Note that,for it to work easier for U,U have to provide the page name ,thus the page.php

The L means LAST ,which ends that particular RewriteRule, the NC means NO CASE that is,it should work no matter the case of the characters(capital or small characters) The QSA means Query String Append means the url is having a query request (that is : ?go=blahblahblah)

Example of a site of rewrite Rules is : http://adrazz.net 😀

ogah Junior · 17 posts #6

Options +Indexes Options +FollowSymlinks RewriteEngine on RewriteBase / RewriteRule /(.*?)$ index.php?go=$1

if your page not automaticaly redirected to new URL, add this code to your index.php

if(isset($_GET["go"]) && strstr($_SERVER["REQUEST_URI"], '?')) {
echo '<meta http-equiv="refresh" content="0; url=http://yourdomain/'.$_GET["go"].'">';
// or use php header location to redirect
exit;
}

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close