473,382 Members | 1,736 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,382 software developers and data experts.

Modifying .htaccess and RewriteBase

160 100+
Hi everyone

I need a little help with a .htaccess file and RewriteBase.

The app I'm trying to run is a php CodeIgnitor app, and the .htaccess looks like it has been coded so that the app will only have correct URLs if the index.php is kept at the server document root. The app author runs all his apps on virtual hosts, but I keep all my apps in subdirectories in my /Sites/ directory (running off the default OS X Apache 1.3). So I need to adjust my app .htaccess so that it takes the subdirectory in to account.

This is how it looks at the moment (when the app expects to be running straight from the document root, i.e. /Sites/index.php);
Expand|Select|Wrap|Line Numbers
  1. Options +FollowSymLinks
  2. RewriteEngine On
  3. RewriteBase /
  4. RewriteCond %{REQUEST_FILENAME} !-f
  5. RewriteCond %{REQUEST_FILENAME} !-d
  6. RewriteRule ^(.*)$ index.php?/$1 [L]
  7.  
The app is located at /Sites/stampychan/index.php, so I was thinking I needed something like this (although, it doesn't seem to work);
Expand|Select|Wrap|Line Numbers
  1. Options +FollowSymLinks
  2. RewriteEngine On
  3. RewriteBase /stampychan
  4. RewriteCond %{REQUEST_FILENAME} !-f
  5. RewriteCond %{REQUEST_FILENAME} !-d
  6. RewriteRule ^(.*)$ index.php?/$1 [L]
  7.  
Jan 3 '10 #1
3 7542
xNephilimx
213 Expert 100+
Hi waqasahmed996.
If I understand correctly, you run you CI (CodeIgniter) app in http://stampychan (or something to that effect), right? If that's correct, it's like a virtual host.
Is /Sites/stampychan the web accessible folder? or you have a public_html or htdocs folder inside? if so, put the app inside that one, and keep the .htaccess file in the same level as the CI app index.php file, and leave RewriteBase just with the /

That should work, but if it doesn't please, provide more specs so I can understand your problem correctly.
Jan 4 '10 #2
waqasahmed996
160 100+
hi xNephilimx ,
Thanks for your kind reply. Yes i exactly facing that problem. i will try your mentioned solution also but currently i solved the problem by using subdomain.
like
http://phones.localhost/

any person who want to know further about subdomain then following link is very useful for him

http://digitalpbk.blogspot.com/2007/...localhost.html
Jan 5 '10 #3
xNephilimx
213 Expert 100+
Nice move! I always recommend the use of virtual hosts, so you can have everything in their own space, it's more organized, and this way you don't have to try to fix the .htaccess

Kind regards
Jan 6 '10 #4

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

Similar topics

1
by: yawnmoth | last post by:
i'm trying to write a php script that will password protect some random directory by creating a .htaccess file, and a password file to accompany the .htaccess file, and it isn't working... ...
0
by: Jack Hambabo | last post by:
Hi, I'm searching for a php script that can find out whether the current user (I know _SERVER will give me the name for non-cgi php) has the right to view a specific file. My dream is that I...
4
by: frizzle | last post by:
Hi group, I have the htaccess code that is below to redirect everything to index.php exept for the mentioned folders. (img, swf, js and css) Now when i try to access domain.com/testfolder/img...
5
by: deko | last post by:
I'm trying to redirect requests for /index.php to /mydirectory/index.php If I use an index file in / with only this line: <?php header("Location:http://www.mysite.com/mydirectory/"); ?> that...
4
by: FFMG | last post by:
Hi, if I have a site htt://www.example.tdl/folder1/folder2/page.html I want to get the folders from the root, so the folder would be $f = './folder1/folder2/' and the page $p = 'page.html'
0
by: xiaawan | last post by:
Hi All, Can Anyone help me to solve this problem. Actually I have two urls and I want both of them to work at the same time for different urls. here is my .htaccess code. AddHandler...
9
by: invertigo | last post by:
Hello, Im using this .htaccess file to rewrite my websites URL. Reason i try to do this is to make it more SEO friendly. Code: -------------------------------------------------------- Options...
0
by: AndyPSV | last post by:
Hello, I've got .htaccess file: RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule (.*) index.php It works properly on mine and...
1
by: gsherp | last post by:
I was wondering if there was anyway in the .htaccess file to access bash scripts. I want to do this because for the mod_rewrite configuration: RewriteBase /home/ { whoami } /www/ is there...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...

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.