简体   繁体   中英

How remove part of url from browser with htacess

I have 2 domains in the same hosting, inside the folder public_html stay the folders and the index.php from the domain principal and inside the public_html have other folder with the name "domain2.com" where have the index.php from www.domain2.com

Actually if enter to www.domain1.com or www.domain2.com function perfectly but if i need enter in www.domain2.com/folder2 dont work for enter in folder "folder2" need put the domain this way www.domain2.com/domain2.com/whereber and this way works

My question is how do I modify the .htacces file so that when entering www.domain2.com/domain2.com/folder2 it only shows the address www.domain2.com/folder

This is my code in htaccess

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTPS} off

RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,QSA]

RewriteCond %{HTTP_HOST} ^(www.)?domain1.com.ar$
RewriteCond %{REQUEST_URI} !^/domain1.com.ar/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /domain1.com.ar/$1

RewriteCond %{HTTP_HOST} ^(www.)?domain2.com.ar$
RewriteRule ^(/)?$ domain2.com.ar/index.php [L]

</IfModule>

I currently use a shared hosting with php 5.6

Thank you very much and excuse my english

Your issue seems to be in your site's root directory configuration.

Basically now it means that your site's files are located in server's root/domain2.com/ .

In a simple words, your domain is connected to a root folder which contains another folder called domain2.com and looks like domain2.com contains your site files.

So in order to fix this, try to locate folder domain2.com in your server and move all files from domain2.com to folder where domain2.com was located.

Could you please specify what server are you using? Are you using shared hosting like cPanel or Plesk or you are using vps/dedicated like iis windows server ?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM