I was working on realurl's in typo3 and spend hours on working out why typo3 is showing only one segment in url.
site structure looks like this:
and URL that I got for subpage 'munchen-maistrasse' is:
http://www.bernd-gruber.at/munchen-maistrasse/
I want it to be:
http://www.bernd-gruber.at/referenzen/munchen-maistrasse/
This is my server .htaccess file:
<FilesMatch "\.(js|css)$">
<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault "access plus 7 days"
</IfModule>
FileETag MTime Size
</FilesMatch>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^(.+)\.(\d+)\.(php|js|css|png|jpg|gif|gzip)$ $1.$3 [L]
RewriteRule ^(typo3/|t3lib/|fileadmin/|typo3conf/|typo3temp/|uploads/|favicon\.ico) - [L]
RewriteRule ^typo3$ typo3/index_re.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* index.php [L]
</IfModule>
AddType video/x-m4v .m4v
AddType video/ogg .ogv
AddType video/webm .webm
AddType video/x-m4v .m4v
AddType application/ogg .ogg
I dont use config.baseURL in typoscript I use:
config.absRefPrefix = /
config.prefixLocalAnchors = all
on my root page. I have runned out of solutions.
You need your own configuration to reach this.
1) In the Extension Manager -> RealUrl -> Configuration you have to disable the automatic configuration and define there the path to your own realUrl configuration file.
2) You should make sure that (page).config.tx_realurl_enable = 1 is set.
3) After making the right realUrl configuration for your website you have to truncate all realUrl caching tables or just remove all ID to Path mappings.
Here some example of a standard realUrl configuration template:
<?php
$realurl_template = array(
'init' => array(
'appendMissingSlash' => 'ifNotFile,redirect',
'enableCHashCache' => 1,
'enableUrlDecodeCache' => 1,
'enableUrlEncodeCache' => 1,
'emptyUrlReturnValue' => '/'
),
'preVars' => array(
array(
'GETvar' => 'no_cache',
'valueMap' => array(
'nc' => 1,
),
'noMatch' => 'bypass',
),
),
'fileName' => array(
'index' => array(
),
),
'postVarSets' => array(
'_DEFAULT' => array (
),
),
'pagePath' => array(
'type' => 'user',
'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
'spaceCharacter' => '-',
'languageGetVar' => 'L',
'expireDays' => 3,
)
);
# Configurate domain names
$TYPO3_CONF_VARS['EXTCONF']['realurl'] = array(
'_DEFAULT' => $realurl_template,
'domain.com' => $realurl_template,
'www.domain.com' => $realurl_template,
);
$TYPO3_CONF_VARS['EXTCONF']['realurl']['domain.com']['pagePath']['rootpage_id'] = 1;
$TYPO3_CONF_VARS['EXTCONF']['realurl']['www.domain.com']['pagePath']['rootpage_id'] = 1;
# Unset template
unset($realurl_template);
?>
Related
user friendly URL in yii2 not working. i can't figure out why.... here is my code from project
eshop/.htaccess
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on
AddDefaultCharset utf-8
RewriteCond %{REQUEST_URL} !^/(web)
RewriteRule ^assets/(.*)$ /web/assets/$1 [L]
RewriteRule ^css/(.*)$ /web/css/$1 [L]
RewriteRule ^fonts/(.*)$ /web/fonts/$1 [L]
RewriteRule ^js/(.*)$ /web/js/$1 [L]
RewriteRule ^images/(.*)$ /web/images/$1 [L]
RewriteRule (.*)$ /web/$1
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /web/index.php
eshop/web/.htaccess
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
eshop/config/web
....
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
'category/<id:\d+>/page/<page:\d+>' => 'category/view',
'category/<id:\d+>' => 'category/view',
'product/<id:\d+>' => 'product/view',
'search' => 'category/search',
],
],
...
it's working without user friendly URL http://yii2.loc/eshop/web/index.php?r=category%2Fview&id=4 but when i use user friendly URL, url become like this http://yii2.loc/eshop/web/category/4 but it's not working. I just got Object not found! help me please
I need some help with UrlManager in Yii2.
I have blog application. There is module called 'blog'. There is BlogController with index action. To run it i must run url like this localhost/myblog/web/blog/blog/index
and
localhost/myblog/web/blog/blog/post?id=4 (for action post).
My settings in web.php are like this:
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
//'enableStrictParsing' => true,
'rules' => [
//'<action:(blog|index|)>' => 'blog/blog/index',
//'/' => 'blog/blog/index'
]
],
I have tried run with line that commented but with no success.
How to configure it to have urls like this localhost/myblog/web/index and localhost/myblog/web/post?id=4 ?
Regards.
"urlManager" alone can not help you. You need to use .htaccess. Then it will work how you want. Please copy bellow codes in you .htaccess. The .htaccess you should put in your root folder.
<IfModule mod_rewrite.c>
RewriteEngine On
</IfModule>
# 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
Hope this will help. Thanks.
My rails app will only display the public directory when I go to the url.
I'm using apache, passenger and ubuntu.
My apache virtualhosts file is;
<VirtualHost *:80>
ServerName www.phusion.nl
DocumentRoot /websites/phusion
<Directory /websites/phusion>
Allow from all
</Directory>
# These have been added:
Alias /subapp /websites/rails/public
<Location /subapp>
PassengerBaseURI /subapp
PassengerAppRoot /websites/rails
</Location>
<Directory /websites/rails/public>
Allow from all
Options -MultiViews
</Directory>
</VirtualHost>
I think everything is installed properly, my config.ru is;
require ::File.expand_path('../config/environment', __FILE__)
run Rails.application
I've added the following to apache2.conf;
LoadModule passenger_module /home/vps/.rvm/gems/ruby-2.0.0-p353/gems/passenger-4.0.35/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot /home/vps/.rvm/gems/ruby-2.0.0-p353/gems/passenger-4.0.35
PassengerDefaultRuby /home/vps/.rvm/gems/ruby-2.0.0-p353/wrappers/ruby
</IfModule>
the apache error.log gives;
All Phusion Passenger agents started!
[ 2014-01-19 09:05:23.8076 12140/7f1e3695c740 agents/Watchdog/Main.cpp:526 ]:
Options: { 'analytics_log_user' => 'nobody', 'default_group' => 'nogroup', 'default_python' => 'python', 'default_ruby' => '/home/vps/.rvm/gems/ruby-2.0.0-p353/wrappers/ruby', 'default_user' => 'nobody', 'log_level' => '0', 'max_pool_size' => '6', 'passenger_root' => '/home/vps/.rvm/gems/ruby-2.0.0-p353/gems/passenger-4.0.35', 'passenger_version' => '4.0.35', 'pool_idle_time' => '300', 'temp_dir' => '/tmp', 'union_station_gateway_address' => 'gateway.unionstationapp.com', 'union_station_gateway_port' => '443', 'user_switching' => 'true', 'web_server_passenger_version' => '4.0.35', 'web_server_pid' => '12137', 'web_server_type' => 'apache', 'web_server_worker_gid' => '33', 'web_server_worker_uid' => '33' }
duh...
I had PassengerAppRoot set to the public folder, not rails root.
This issue may be because of the way you installed the Passenger module
Wrong way : sudo passenger-install-apache2-module
Right way : rvmsudo passenger-install-apache2-module
I am just guessing you used the first one which is leading to this issue, please correct me if i'm wrong.
I was able to minify a CSS file with the following code block using Zend 2 Module AssetManager (link) but have a problem with caching. How do I configure it to cache the CSS file?
I see a HTTP status with 200 OK for the CSS file in Firebug. If the CSS file is cached, it should be 304 Not Modified.
Note that the Apache web server has read and write permissions for "public" directory and anything inside of the directory.
'asset_manager' => array(
'resolver_configs' => array(
'paths' => array(
__DIR__ . '/../public'
)
),
'filters' => array(
'css/a.css' => array(
array(
'filter' => 'UglifyCss'
)
)
),
'caching' => array(
'a.css' => array(
'cache' => 'FilePath',
'options' => array(
'dir' => __DIR__ . '/../public'
)
)
)
)
If the CSS file is cached, it should be 304 Not Modified.
No, it should only be a 304 if you configured browser caching in youre configuration. If you configure browser caching in the AsseticModule it only meens that the minified and combined css/js files are cached on youre system and not generated on every request.
Put something like this in youre .htaccess under public folder.
# ----------------------------------------------------------------------
# Expires headers (for better cache control)
# ----------------------------------------------------------------------
<IfModule mod_expires.c>
# Mod aktivieren
ExpiresActive on
# Standard Cache
ExpiresDefault "access plus 1 minute"
# Media
ExpiresByType image/gif "access plus 1 minute"
ExpiresByType image/jpeg "access plus 1 minute"
ExpiresByType image/jpg "access plus 1 minute"
ExpiresByType image/png "access plus 1 minute"
ExpiresByType application/javascript "access plus 1 minute"
ExpiresByType text/css "access plus 1 minute"
</IfModule>
Hello guys i have problem in ZF2 with htaccess.
I create vhost and all work good. when i call
my-vhost.localhost all work good but when i add some uri segment like /index.php or /1234
I get 404.
I edit .htaccess in public dir and put
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^.*$ index.php [NC,L]
Bur again i have 404. Any idea how i can i slow this?
My full .htaccess is :
RewriteEngine On
# The following rule tells Apache that if the requested filename
# exists, simply serve it.
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
# The following rewrites all other queries to index.php. The
# condition ensures that if you are using Apache aliases to do
# mass virtual hosting, the base path will be prepended to
# allow proper resolution of the index.php file; it will work
# in non-aliased environments as well, providing a safe, one-size
# fits all solution.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^.*$ index.php [NC,L]
RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::\2$
RewriteRule ^(.*) - [E=BASE:%1]
RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L]
VHOST
<VirtualHost *:80>
ServerName zf2-tutorial.localhost
DocumentRoot /var/www/html/zf2-tutorial/public
SetEnv APPLICATION_ENV "development"
<Directory /var/www/html/zf2-tutorial/public>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Who think problem is routing check my route mod.
<?php
return array(
'controllers' => array(
'invokables' => array(
'Album\Controller\Album' => 'Album\Controller\AlbumController',
),
),
// The following section is new and should be added to your file
'router' => array(
'routes' => array(
'album' => array(
'type' => 'segment',
'options' => array(
'route' => '/album[/][:action][/:id]',
'constraints' => array(
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'id' => '[0-9]+',
),
'defaults' => array(
'controller' => 'Album\Controller\Album',
'action' => 'index',
),
),
),
),
),
'view_manager' => array(
'template_path_stack' => array(
'album' => __DIR__ . '/../view',
),
),
);
The contents of the shipped .htaccess file are as follows;
RewriteEngine On
# The following rule tells Apache that if the requested filename
# exists, simply serve it.
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
# The following rewrites all other queries to index.php. The
# condition ensures that if you are using Apache aliases to do
# mass virtual hosting, the base path will be prepended to
# allow proper resolution of the index.php file; it will work
# in non-aliased environments as well, providing a safe, one-size
# fits all solution.
RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::\2$
RewriteRule ^(.*) - [E=BASE:%1]
RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L]
It differs very slightly from your copy, I have tried your .htaccess file on a working example and it appears fine.
Is the 404 you are getting a generic "server looking" 404 or is it a ZF2 themed page?
Might be a silly suggestion but have you tried http://my-vhost.localhost/public or http://my-vhost.localhost/public/album ???
As far as I know you shouldnt need to call .php files directly
Im not sure it is too late to answer this question, as Finbarr suggest to try with
http://my-vhost.localhost/public or http://my-vhost.localhost/public/album.
I had also the same problem everytime I type www.zf2-tutorial.loc it always was redirected to xampp main page.
Finally i read the comments froom Finbarr i changed to
http://www.zf2-tutorial.loc/zf2-tutorial/public/
after that the webspage: Welcome to Zend Framework 2 was loaded.
#the virtual host:
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "C:\xampp\htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
<DocumentRoot "C:/xampp/htdocs/zf2-tutorial/public"
ServerName www.zf2-tutorial.loc zf2-tutorial.loc
ServerAlias zf2-tutorial.loc
<Directory "C:/xampp/htdocs/zf2-tutorial/public">
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
in the host I made several combinations trying to find out which one was correct.
127.0.0.1 localhost
127.0.0.1 www.zf2-tutorial.loc zf2-tutorial.loc
127.0.0.1 www.zf2-tutorial.loc zf2-tutorial.loc localhost
127.0.0.1 www.zf2-tutorial.loc localhost
127.0.0.1 www.zf2-tutorial.loc
127.0.0.1 zf2-tutorial.loc localhost
127.0.0.1 zf2-tutorial.loc
the apache (httpd conf) has this settings some people suggest to delete he hash tag but I didn't work for me so left it as i found it:
# Virtual hosts
# Include conf/extra/httpd-vhosts.conf
Also in the same file (httpd conf) I change the AllowOverride None to AllowOverride FileInfo as follows:
<Directory />
AllowOverride FileInfo
Require all denied
</Directory>
re started the xampp and it was displayed the congratulations web page.