473,385 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Redirecting through .htaccess

49
I want to redirect a url http://abc.xyz.com/123 to http://www.xyz.com. So the file that will be accessed will be index.php of xyz.com. That index.php should have available to it both abc and 123 (so 123 will be $_SERVER['PHP_SELF'], and abc will come out of $_SERVER['HTTP_HOST']) to enable appropriate processing.

http://abc.xyz.com already goes to http://www.xyz.com (though configuration by my service provider), and abc can be extracted out of $_SERVER['HTTP_HOST']. However, http://abc.xyz.com/123 seems to be looking for a folder called 123 in the root directory of xyz.com, and is showing up a 404 error when it cannot find any.

Can someone kindly give me the line(s) to be put in .htaccess to enable http://abc.xyz.com/123 to call index.php of http://www.xyz.com (with 123 being available though $_SERVER['PHP_SELF']? I cannot seem to get it to work.

Thank you very much for your time!
Dec 1 '09 #1
2 2202
numberwhun
3,509 Expert Mod 2GB
I am by no means an expert on this topic, but does this link give you the information you want?

By searching Google, you can find a lot of articles on this topic. If the above doesn't work for you, check them out.

Regards,

Jeff
Dec 2 '09 #2
knkk
49
Thanks, Jeff. I found the solution for my subdomain subdirectory redirection problem above, here it is:

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URL} !=/favicon.ico
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
Dec 3 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: DeathStorm | last post by:
How do i redirect to a different page without out changeing the address in the address bar but allowing the title to change?
1
by: susb8383 | last post by:
Using htaccess, is there a way to redirect just the home page? So in other words, if someone goes to www.domain1.com, they are redirected to www.domain2.com. However, if someone goes to...
8
by: SmartPHP | last post by:
I'm trying to build a site using PHP and apache. I have menu as my main navigation and tree on the left pane as secondary navigation for moving to different pages. i'm also using .htaccess file for...
1
by: chewster | last post by:
Hi. I'm very new to the .htaccess and currently trying to figure this out. I'd like to redirect a parked domain to a sub domain or a folder without showing the actual address location. So far I'm...
41
by: amygdala | last post by:
Hello all, I have posted a similar question in comp.lang.php in the past, but haven't had any response to it then. I kinda swept the problem under the rug since then. But I would really like to...
1
by: dheeraj4uuu | last post by:
Hii I have an Smf forum, and i installed SEO4SMF to my forum and i made some modifications to my htaccess file.but after doing so everything works fine but i noticed that after going to some...
4
by: Guy Macon | last post by:
As a personal learning experience with limited practical use, I have been doing some experiments with using .htaccess to redirect mis-typed URLs to a preferred canonical form. I have set up a...
1
by: sarayu | last post by:
We are currently running the developed php script in IIS.And in that they use the url redirection in .htaccess file.When we want to run the code we get pagenot found errors.where can i change the...
2
Markus
by: Markus | last post by:
Why is it not working? I joke. Here's the info: In the folder C:\host\www\test, I have an .htaccess file. Inside that .htaccess file is the following: RewriteEngine On RewriteRule...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.