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
How to make PHP applications fasterHow to make PHP applications fasterMay 12, 2025 am 12:12 AM

TomakePHPapplicationsfaster,followthesesteps:1)UseOpcodeCachinglikeOPcachetostoreprecompiledscriptbytecode.2)MinimizeDatabaseQueriesbyusingquerycachingandefficientindexing.3)LeveragePHP7 Featuresforbettercodeefficiency.4)ImplementCachingStrategiessuc

PHP Performance Optimization Checklist: Improve Speed NowPHP Performance Optimization Checklist: Improve Speed NowMay 12, 2025 am 12:07 AM

ToimprovePHPapplicationspeed,followthesesteps:1)EnableopcodecachingwithAPCutoreducescriptexecutiontime.2)ImplementdatabasequerycachingusingPDOtominimizedatabasehits.3)UseHTTP/2tomultiplexrequestsandreduceconnectionoverhead.4)Limitsessionusagebyclosin

PHP Dependency Injection: Improve Code TestabilityPHP Dependency Injection: Improve Code TestabilityMay 12, 2025 am 12:03 AM

Dependency injection (DI) significantly improves the testability of PHP code by explicitly transitive dependencies. 1) DI decoupling classes and specific implementations make testing and maintenance more flexible. 2) Among the three types, the constructor injects explicit expression dependencies to keep the state consistent. 3) Use DI containers to manage complex dependencies to improve code quality and development efficiency.

PHP Performance Optimization: Database Query OptimizationPHP Performance Optimization: Database Query OptimizationMay 12, 2025 am 12:02 AM

DatabasequeryoptimizationinPHPinvolvesseveralstrategiestoenhanceperformance.1)Selectonlynecessarycolumnstoreducedatatransfer.2)Useindexingtospeedupdataretrieval.3)Implementquerycachingtostoreresultsoffrequentqueries.4)Utilizepreparedstatementsforeffi

Simple Guide: Sending Email with PHP ScriptSimple Guide: Sending Email with PHP ScriptMay 12, 2025 am 12:02 AM

PHPisusedforsendingemailsduetoitsbuilt-inmail()functionandsupportivelibrarieslikePHPMailerandSwiftMailer.1)Usethemail()functionforbasicemails,butithaslimitations.2)EmployPHPMailerforadvancedfeatureslikeHTMLemailsandattachments.3)Improvedeliverability

PHP Performance: Identifying and Fixing BottlenecksPHP Performance: Identifying and Fixing BottlenecksMay 11, 2025 am 12:13 AM

PHP performance bottlenecks can be solved through the following steps: 1) Use Xdebug or Blackfire for performance analysis to find out the problem; 2) Optimize database queries and use caches, such as APCu; 3) Use efficient functions such as array_filter to optimize array operations; 4) Configure OPcache for bytecode cache; 5) Optimize the front-end, such as reducing HTTP requests and optimizing pictures; 6) Continuously monitor and optimize performance. Through these methods, the performance of PHP applications can be significantly improved.

Dependency Injection for PHP: a quick summaryDependency Injection for PHP: a quick summaryMay 11, 2025 am 12:09 AM

DependencyInjection(DI)inPHPisadesignpatternthatmanagesandreducesclassdependencies,enhancingcodemodularity,testability,andmaintainability.Itallowspassingdependencieslikedatabaseconnectionstoclassesasparameters,facilitatingeasiertestingandscalability.

Increase PHP Performance: Caching Strategies & TechniquesIncrease PHP Performance: Caching Strategies & TechniquesMay 11, 2025 am 12:08 AM

CachingimprovesPHPperformancebystoringresultsofcomputationsorqueriesforquickretrieval,reducingserverloadandenhancingresponsetimes.Effectivestrategiesinclude:1)Opcodecaching,whichstorescompiledPHPscriptsinmemorytoskipcompilation;2)DatacachingusingMemc

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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

EditPlus Chinese cracked version

EditPlus Chinese cracked version

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

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft