Ask a question in MVC mode. Please help me.

Source: Internet
Author: User
Ask a question in MVC mode. Please help. MVC link root directory

Recently, I have been studying MVC development. Now we have a problem. I use Smarty as V. My entire website is on. Under the WWW/ECHO directory. A problem occurs. for example, you cannot directly enter a link such as control/method when linking. You need/echo/control/method to perform the operation. If not. There will be a problem. for example, my current page is localhost/echo/index, and my default controller and method are indexes. I use this page to link to the article page. You can access it through access. However, if the method name is added to my homepage, it becomes. Localhost/echo/index. the address localhost/echo/index/article/index appears when you access the article page using the above link .. How can I solve this problem. I'm a Tom. hope you can help me.


Reply to discussion (solution)

./Index. php/controller/action

./Index. php/controller/action
I used. htaccess to hide index. php. Is the URL overwritten. Is there a way to rewrite my link and locate my directory to/echo. Of course. If my entire website is under the root directory of www.www/, this problem may not occur .. But is there a solution to this problem? Amount

You have to check the directory settings of your site.

You have to check the directory settings of your site. What do you mean. How to set it. RewriteBase/echo
Is that true?

In the. htaccess Directory of the website root directory, assign the url to echo
RewriteRule ^ (/?) (. *) $/Echo/$2 [PT, L]

Project ing using. htaccess in the echo Directory
RewriteRule ^ (. *) $ index. php/$1 [QSA, PT, L]

In the. htaccess Directory of the website root directory, assign the url to echo
RewriteRule ^ (/?) (. *) $/Echo/$2 [PT, L]

Project ing using. htaccess in the echo Directory
RewriteRule ^ (. *) $ index. php/$1 [QSA, PT, L]
This is true. But no other ones can be accessed...

In the. htaccess Directory of the website root directory, assign the url to echo
RewriteRule ^ (/?) (. *) $/Echo/$2 [PT, L]

Project ing using. htaccess in the echo Directory
RewriteRule ^ (. *) $ index. php/$1 [QSA, PT, L]
Maybe .. Is it because I think too much? Actually, there are not many such applications, right? That is to say, most websites are stored in the root directory. And there will be no more two websites in the root directory?

In the. htaccess Directory of the website root directory, assign the url to echo
RewriteRule ^ (/?) (. *) $/Echo/$2 [PT, L]

Project ing using. htaccess in the echo Directory
RewriteRule ^ (. *) $ index. php/$1 [QSA, PT, L]
Ah. Moderator, do you have any suggestions for learning MVC. Or is there any resource for me to watch and learn. You can learn from small projects that have been written by wood or wood.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.