search
HomeBackend DevelopmentPHP Tutorial在window的IIS下建立的php网站为何只有首页能正常浏览???请求指点迷津

公司找外面的网站制作公司给做了一个网站(php的,使用了Yii框架),原来网站是租用的别人空间(Linux+Apache+MySQL),现在领导想把网站放自己服务器上(windows2008),现在在我们自己服务器的PHP运行环境都已搭建完毕,把网站源码放入后只能正常浏览首页,对于首页中的链接都没法正常浏览,点开就提示404错误。比如:关于我们 这个链接指向 /category/4, 但是在网站根目录下找不到Category目录,我很奇怪的是这个网站在原来租用的空间上是没有问题的,为何到我这里就不可以了?????我确信所有网站文件都已ftp下载
是否与Yii框架有关,我需要做什么设定?(本人对PHP和Yii框架都不懂),请求明白的给指点迷津


回复讨论(解决方案)

调整 Yii 项目的路由模式

apache 可以轻松的支持 url 重写,而 iis 就不那么容易了
需要安装重写插件,在正版的系统中安装盗版的插件,总是不太好吧。虽然有免费的,但功能弱了许多。也不知道是否能满足你的需求

怎么调整Yii的路由模式啊?我在windows下也安装了Apache,但是也是只有首页正常,里面的链接不能正常浏览。网站的后台管理没问题

也是 apache ?
那么开启 url 重写不就行了吗

我猜是URL重写的问题。


对Apache配置不怎么懂,刚才百度一下把URL重写开启后,现在不出404错误了,但是会直接链接到原来网站的域名下
比如我在本地测试的网址为: http://192.168.1.8/,当点击“关于我们后”(链接“category/4”),现在就跑到原来网站域名下去了 http://www.xxxxxxx.com/category/4 
我能否修改一下这个路由,让他适应当前的网站地址呢????


对Apache配置不怎么懂,刚才百度一下把URL重写开启后,现在不出404错误了,但是会直接链接到原来网站的域名下
比如我在本地测试的网址为: http://192.168.1.8/,当点击“关于我们后”(链接“category/4”),现在就跑到原来网站域名下去了 http://www.xxxxxxx.com/category/4 
我能否修改一下这个路由,让他适应当前的网站地址呢????
那你修改.htaccess文件,或者修改conf.php文件。

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Working with Flash Session Data in LaravelWorking with Flash Session Data in LaravelMar 12, 2025 pm 05:08 PM

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

cURL in PHP: How to Use the PHP cURL Extension in REST APIscURL in PHP: How to Use the PHP cURL Extension in REST APIsMar 14, 2025 am 11:42 AM

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Simplified HTTP Response Mocking in Laravel TestsSimplified HTTP Response Mocking in Laravel TestsMar 12, 2025 pm 05:09 PM

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

12 Best PHP Chat Scripts on CodeCanyon12 Best PHP Chat Scripts on CodeCanyonMar 13, 2025 pm 12:08 PM

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

Explain the concept of late static binding in PHP.Explain the concept of late static binding in PHP.Mar 21, 2025 pm 01:33 PM

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

PHP Logging: Best Practices for PHP Log AnalysisPHP Logging: Best Practices for PHP Log AnalysisMar 10, 2025 pm 02:32 PM

PHP logging is essential for monitoring and debugging web applications, as well as capturing critical events, errors, and runtime behavior. It provides valuable insights into system performance, helps identify issues, and supports faster troubleshoot

Discover File Downloads in Laravel with Storage::downloadDiscover File Downloads in Laravel with Storage::downloadMar 06, 2025 am 02:22 AM

The Storage::download method of the Laravel framework provides a concise API for safely handling file downloads while managing abstractions of file storage. Here is an example of using Storage::download() in the example controller:

HTTP Method Verification in LaravelHTTP Method Verification in LaravelMar 05, 2025 pm 04:14 PM

Laravel simplifies HTTP verb handling in incoming requests, streamlining diverse operation management within your applications. The method() and isMethod() methods efficiently identify and validate request types. This feature is crucial for building

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function