Need help for my Url path

@dklynn,

Hi, can I ask some help please, the path of my site is like this

http://myappdomain.x10host.com/home/expensex/public_html/site/about

how can I make my path look good like this.

http://myappdomain.x10host.com/site/about

here is the htaccess

Options +FollowSymLinks
IndexIgnore */*

RewriteEngine on

# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# otherwise forward it to index.php
RewriteRule . index.php

but every time I navigate each page it always append in my path this

home/expensex/public_html

Thank you in advance.

Hi jemz,

The easiest way is to edit the httpd-vhosts.conf file and make the local website’s DocumentRoot your public_html folder.

Personally, I’d make /site your DocumentRoot so you can have multiple virtual domains on your test server.

Edit (admin mode) c:\Windows\System32\drivers\etc\hosts to add “127.0.0.1 site”; be sure to be in admin mode or WinDoze will not allow you to save.

Edit your {apache-path-to-conf/extra/httpd-vhosts.conf to add:

<VirtualHost 127.0.0.1:80>
ServerName site
DocumentRoot W:/site
// be sure to use the correct path - I have my websites on a W partition
ServerPath W:/site
// ditto

… then restart Apache.

Too much bother?

Modify your .htaccess file at http://myappdomain.x10host.com/ (!?!) to use:

RewriteEngine on Rewrite Rule ^site/([a-z]+)$ home/expensex/public_html/site/$1 [L]

Assuming that you can do that, it will capture every lowercase file request for your site directory and redirect it internally to the correct (extensionless) file.

Regards,

DK

I apologize for my late reply…Okay I will try I will let you know if it’s working.

By the way, I cannot access the httpd-vhosts.conf in the free hosting site.

Thank you so much :smile:

jemz,

Okay, stuck on a freebie server means that you MUST run though your “domain’s” DocumentRoot so you will have to place your code in the first directory level in the path to which you have access (and you will NOT be able to “hide” any levels above that on the server - that’s the cost of freebie servers).

Note: Good hosts can provide very inexpensive shared accounts where you control your own domain name and don’t even need to make a redirection like you’re trying to make.

Regards,

DK

Thank you , I just want to try the yii2 framework to deploy in the free hosting site, and this is what I followed base on the docs.

Deploying a basic application Yii2

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.