0

我正在尝试在 WAMP 系统上使用 TYPO3,但我遇到了重写 URL 的问题。我已经安装了具有“入门”网站的介绍包。每次我尝试通过以下之一访问网站时:localhost/typo3 localhost/typo3/index.php localhost/typo3/index.php/get-started

url 变成 localhost/typo3/get-started

没关系,这意味着 mod_rewrite 已打开并正在工作。问题是我看不到站点 localhost/typo3/get-started,而我有一个“找不到对象”页面。

我在使用 Symfony 1.4 的同一台机器上遇到了同样的问题,但我从不关心这个问题,因为在 Symfony 上我可以使用 frontend_dev.php 页面访问该站点(在我的生产环境中,重写 URL 可以正常工作)。

这是 TYPO3 目录的 httpd.conf 条目:

Alias /typo3 "C:\workspace\typo3"
<Directory "C:\workspace\typo3">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>

这是 .htaccess 文件(已经在 TYPO3 包中,我没有修改),我已经删除了不相关的部分

### Begin: Settings for mod_rewrite ###

# You need rewriting, if you use a URL-Rewriting extension (RealURL, CoolUri, SimulateStatic).

<IfModule mod_rewrite.c>

# Enable URL rewriting
RewriteEngine On

# Change this path, if your TYPO3 installation is located in a subdirectory of the website root.
#RewriteBase /

# Rule for versioned static files, configured through:
# - $TYPO3_CONF_VARS['BE']['versionNumberInFilename']
# - $TYPO3_CONF_VARS['FE']['versionNumberInFilename']
# IMPORTANT: This rule has to be the very first RewriteCond in order to work!
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)\.(\d+)\.(php|js|css|png|jpg|gif|gzip)$ $1.$3 [L]

# Stop rewrite processing, if we are in the typo3/ directory.
# For httpd.conf, use this line instead of the next one:
# RewriteRule ^/TYPO3root/(typo3/|t3lib/|fileadmin/|typo3conf/|typo3temp/|uploads/|favicon\.ico) - [L]
RewriteRule ^(typo3/|t3lib/|fileadmin/|typo3conf/|typo3temp/|uploads/|favicon\.ico) - [L]

# Redirect http://example.com/typo3 to http://example.com/typo3/index_re.php and stop the rewrite processing.
# For httpd.conf, use this line instead of the next one:
# RewriteRule ^/TYPO3root/typo3$ /TYPO3root/typo3/index.php [L]
RewriteRule ^typo3$ typo3/index_re.php [L]

# If the file/symlink/directory does not exist => Redirect to index.php.
# For httpd.conf, you need to prefix each '%{REQUEST_FILENAME}' with '%{DOCUMENT_ROOT}'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l

# Main URL rewriting.
# For httpd.conf, use this line instead of the next one:
# RewriteRule .* /TYPO3root/index.php [L]
RewriteRule .* index.php [L]

</IfModule>

### End: Settings for mod_rewrite ###
4

2 回答 2

2

解决了,问题出在easyphp设置上,因为我没有使用它的DocumentRoot(而只是使用别名),将DocumentRoot更改为我保留项目的那个就解决了

于 2012-11-11T10:02:44.917 回答
1

您应该按照文件中的说明更改#RewriteBase /为。RewriteBase /typo3/.htaccess

于 2012-11-13T19:31:32.540 回答