Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.