Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I currently have

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ ^ezrahub.com/index.php/$1 [QSA,L]
</IfModule>

Which is fine if I have a single site, but I didn't realize this would mess up every other domain on my server (yikes!.

I basically only want to rewrite http://ezrahub.com/index.php/$1 to remove the index.php and create a clean URL on that domain and not show the index.php... apologies for the noob question.. how do I need to approach this?

share|improve this question
3  
You should have separate <VirtualHost> entries for each domain on your server, and typically, none of them should be sharing directories. Something is very strange about your setup. Can you describe it in much more detail? –  Michael Hampton Jan 29 '13 at 6:45
    
You're right, they shouldn't share directories, but since these are not really production level sites and are used simple for experimentation two sites do share the same directory... (which creates problems, as I realize) –  wnajar Jan 29 '13 at 18:11

1 Answer 1

up vote 0 down vote accepted

While I agree with Michael Hamptons response, here's a quick fix to do what you want:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{HTTP_HOST} ezrahub.com
    RewriteRule ^(.*)$ ^ezrahub.com/index.php/$1 [QSA,L]
</IfModule>

As you see, I added the condition that the Host header be ezrahub.com, in addittion to requiring that the file is nonexistent.

Kudos to you for using your actual hostname, it makes it a lot easier to help!

share|improve this answer
    
That's what I needed. Also worth noting that that code isn't actually correct, the rewriterule should be RewriteRule ^(.*)$ index.php/$1 [QSA,L] –  wnajar Jan 29 '13 at 18:17
1  
You're completely right about the RewriteRule, sorry I missed that - I was just focusing on the conditions! –  Jenny D Jan 30 '13 at 7:34

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.