Jump to content

rewrite problem


djp1988

Recommended Posts

I have multiple domains sharing the disk space on a server, domain1.com takes it's index from the root of the hosting, and domain2.com has it's index in a folder named "site2/" found alongside the files of domain1.com

 

So, domain2.com = domain1.com/site2/

 

I am trying to rewrite .php to .html, for domain1.com it is fine, but for domain2.com, the url the server is trying te retreive isn't domain2.com/file.php, it has taken the relative address from the root, so it's trying to get domain2.com/site2/file.php

 

How can I remove the folder's name from the rewrite?

 

exemple:

 

domain2.com/shop.html    // get domain2.com/shop.php is what I want

domain2.com/site2/shop.php  // I get this

 

What I need to do is set the $, variable to only take the url AFTER "/site2/" for this website, how can I write this in the .htaccess code?

 

This is the code:

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)\.html$ $1.php [nc]

 

I thought maybe:

 

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^/site2/(.*)\.html$ $1.php [nc]

 

But this didn't work

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/136811-rewrite-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.