Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

CF and .htaccess Help!!!

Explorer ,
May 14, 2008 May 14, 2008
I need help in creating a dynamic .htaccess file... I currently have the following set up and it works great...

RewriteEngine on
RewriteRule ^([^/]*)\.html$ http://www.mysite.com/mydir/thepage.cfm?pagename_id=$1

So if you were to go to www.mysite.com/mydir/hello-world.html it will work perfectly

-------------------------------------------

Here is the situation though....

1. I need to create a dynamic .htaccess file because multiple sites are going to be sharing the same "webfiles" on the server.

For instance:

mysite.com will access files "a"
yoursite.com will access files "a" also.


So the issue here is that if my .htaccess file has http://www.mysite.com hardcoded into the file, then if yoursite.com tries to access the "a" files, then it will automatically redirect to mysite.com

How do I create a .htaccess file that will interpret what the web site is and automatically change the .htaccess...

For instance:

mysite.com .htaccess will be

RewriteEngine on
RewriteRule ^([^/]*)\.html$ http://www.mysite.com/mydir/thepage.cfm?pagename_id=$1

and yoursite.com .htaccess will be

RewriteEngine on
RewriteRule ^([^/]*)\.html$ http://www.yoursitecom/mydir/thepage.cfm?pagename_id=$1

Is there anyway to make this part (the ???????) dynamic: http://www.?????????.com/mydir/thepage.cfm?pagename_id=$1

Anyones help on this would be greatly appreciated!!!!!!
TOPICS
Getting started
457
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Explorer , May 15, 2008 May 15, 2008
Thanks. That worked perfectly... Must have lost my mind for a few 🙂
Translate
Contributor ,
May 15, 2008 May 15, 2008
why do you need the domain name in the rewrite rule at all? what's wrong with...or does the mydir bit change per domain?

RewriteEngine on
RewriteRule ^([^/]*)\.html$ /mydir/thepage.cfm?pagename_id=$1
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 15, 2008 May 15, 2008
LATEST
Thanks. That worked perfectly... Must have lost my mind for a few 🙂
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources