Free Web Hosting Forum
(#1 (permalink))
Old
Junior Member
instantcarma is on a distinguished road
 
Posts: 4
Join Date: Oct 2008
Default .htaccess URL rewrite - 11-10-2009, 08:00 AM

I try to get .htaccess to do URL rewrite

this is my .htaccess:

Quote:
RewriteEngine on
RewriteRule home index.php?id=1
RewriteRule howyoucanbehelped index.php?id=2
RewriteRule company index.php?id=3
But it doesn't work, I get transferred to http://error.000webhost.com/ instead.

What to do? This code has worked on other hosts...
Reply With Quote
Sponsored Links
(#2 (permalink))
Old
chanh's Avatar
Administrator
chanh is on a distinguished road
 
Posts: 1,888
Join Date: Dec 2008
Default 11-10-2009, 11:21 AM

add rewritebase /

this question has been answer numerous time please search the forum and you will have answer to most your question. Thanks
Reply With Quote
(#3 (permalink))
Old
Junior Member
instantcarma is on a distinguished road
 
Posts: 4
Join Date: Oct 2008
Default 11-10-2009, 06:31 PM

RewriteBase / alone didn't do it.

After doing my research I finally got following to work:

Quote:
RewriteEngine on
RewriteBase /
RewriteRule ^/?home$ index.php?id=1[L]
RewriteRule ^/?howyoucanbehelped$ index.php?id=3[L]
RewriteRule ^/?company$ index.php?id=2[L]
I understand that as a moderator it gets old to see the same question over and over again, and for a end user like me it's a pain to have to detective work for everything so...
it would be exellent if common code snippets like this was added to a FAQ or stickied!
Reply With Quote
(#4 (permalink))
Old
chanh's Avatar
Administrator
chanh is on a distinguished road
 
Posts: 1,888
Join Date: Dec 2008
Default 11-10-2009, 06:55 PM

http://www.000webhost.com/faq.php?ID=14

Plus, please see my FAQ guide in my signature.
Reply With Quote
(#5 (permalink))
Old
Junior Member
weilunt0219 is on a distinguished road
 
Posts: 4
Join Date: Jul 2011
Default 10-09-2011, 08:20 AM

Ok, I've tried the advice from the FAQ:
http://www.000webhost.com/faq.php?ID=14

but I still can't seem to get it to work. Here's what I tried:

Code:
# Rewrite subdomain requests to subdirectories except for katharou.comuf.com
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/sd_
RewriteCond %{HTTP_HOST} !^www\.katharou\.comuf.com [NC]
RewriteCond %{HTTP_HOST} ^([^.]+)\.katharou\.comuf.com
RewriteRule (.*) /sd_%1/$1 [L]
#
# Redirect direct user-agent requests for www.katharou.comuf.com/sd_greg/index.html to http://greg.katharou.cu.cc/index.html
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /sd_(.+)\ HTTP/
RewriteRule ^sd_([^/]+)/(.*)$ http://$1.katharou.comuf.com/$2 [R=301,L]

# Rewrite subdomain requests to subdirectories except for www.katharou.cu.cc
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/sd_
RewriteCond %{HTTP_HOST} !^www\.katharou\.cu.cc [NC]
RewriteCond %{HTTP_HOST} ^([^.]+)\.katharou\.cu.cc
RewriteRule (.*) /sd_%1/$1 [L]
#
# Redirect direct user-agent requests for www.katharou.cu.cc/sd_greg/index.html to http://greg.katharou.cu.cc/index.html
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /sd_(.+)\ HTTP/
RewriteRule ^sd_([^/]+)/(.*)$ http://$1.katharou.cu.cc/$2 [R=301,L]
and I've also tried
Code:
# Rewrite subdomain requests to subdirectories except for katharou.comuf.com
RewriteEngine On
RewriteBase /sd_greg
RewriteCond %{REQUEST_URI} !^/sd_
RewriteCond %{HTTP_HOST} !^www\.katharou\.comuf.com [NC]
RewriteCond %{HTTP_HOST} ^([^.]+)\.katharou\.comuf.com
RewriteRule (.*) /sd_%1/$1 [L]
#
# Redirect direct user-agent requests for www.katharou.comuf.com/sd_greg/index.html to http://greg.katharou.cu.cc/index.html
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /sd_(.+)\ HTTP/
RewriteRule ^sd_([^/]+)/(.*)$ http://$1.katharou.comuf.com/$2 [R=301,L]

# Rewrite subdomain requests to subdirectories except for www.katharou.cu.cc
RewriteEngine On
RewriteBase /sd_greg
RewriteCond %{REQUEST_URI} !^/sd_
RewriteCond %{HTTP_HOST} !^www\.katharou\.cu.cc [NC]
RewriteCond %{HTTP_HOST} ^([^.]+)\.katharou\.cu.cc
RewriteRule (.*) /sd_%1/$1 [L]
#
# Redirect direct user-agent requests for www.katharou.cu.cc/sd_greg/index.html to http://greg.katharou.cu.cc/index.html
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /sd_(.+)\ HTTP/
RewriteRule ^sd_([^/]+)/(.*)$ http://$1.katharou.cu.cc/$2 [R=301,L]
Only to no avail, can I get some help? I'm sorry, I'm new to .htaccess mods.
Reply With Quote
(#6 (permalink))
Old
Junior Member
weilunt0219 is on a distinguished road
 
Posts: 4
Join Date: Jul 2011
Default 10-10-2011, 01:40 AM

Ok, so now I've editted my .htaccess code. It still doesn't work though.

Here's what I have:
Code:
<IfModule mod_rewrite.c>
RewriteBase /
RewriteEngine On

RewriteCond %{REQUEST_URI} !^/sd_
RewriteCond %{HTTP_HOST} !^www\.katharou\.cu.cc [NC]
RewriteCond %{HTTP_HOST} ^([^.]+)\.katharou\.cu.cc
RewriteRule (.*) /sd_%1/$1 [L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /sd_(.+)\ HTTP/
RewriteRule ^sd_([^/]+)/(.*)$ http://$1.katharou.cu.cc/$2 [R=301,L]
</IfModule>
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Forum Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.5.2
vBulletin Skin developed by: vBStyles.com