Cant remove /index.php from address

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Post Reply
aleksiejs
New Member
New Member
Posts: 2
Joined: Mon Dec 14, 2015 1:17 pm

Cant remove /index.php from address

Post by aleksiejs »

Hello,

It's my first post here.
I have problem with address of my website. I don't want to have duplicate content

How can I make redirection from domain.com/index.php to domain.com?

My htaccess file looks now:

Code: Select all

# Attempt to override some php settings, these settings may be helpful on some hosts if your
# default configuration does not meet CMS's minimum requirements, and your host
# has given your account appropriate permissions
#php_value upload_max_filesize "10M"
#php_value session_save_path "tmp/cache"

#php_flag magic_quotes_gpc Off
#php_flag register_globals Off
#php_flag session.use_trans_sid Off

# This is important, so uncomment if your host permit
#Options -Indexes
#ServerSignature Off
#php_value session.cookie_httponly true

#Options +FollowSymLinks

# To prevent E_STRICT problems with PHP 5.3+ you can uncomment the following lines
# Note: These settings should only be enabled for production sites!
#php_flag display_startup_errors 0
#php_flag display_errors 0
#php_flag html_errors 0
#php_value docref_root 0
#php_value docref_ext 0

<IfModule mod_rewrite.c>
RewriteEngine on
#
#Sub-dir e.g: /cmsms
RewriteBase /

RewriteCond %{HTTP_HOST} ^www.prestige-line.pl(.*) [NC]
RewriteRule ^(.*)$ http://prestige-line.pl/$1 [R=301,L]

# 301 Redirect all requests that don't contain a dot or trailing slash to
# include a trailing slash
# but ignore POST requests.
#RewriteCond %{REQUEST_URI} !/$
#RewriteCond %{REQUEST_URI} !\.
#RewriteCond %{REQUEST_METHOD} !POST$
#RewriteRule ^(.*) %{REQUEST_URI}/ [R=301,L]

# Rewrites urls in the form of /parent/child/
# but only rewrites if the requested URL is not a file or directory
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.+)$ index.php?page=$1 [QSA]

</IfModule>

<IfModule mod_headers.c>
# Disable ETags
Header unset ETag
FileEtag None
# For Security
Header set X-Frame-Options "SAMEORIGIN"
</IfModule>

<IfModule mod_deflate.c>
# Compress css, plaintext, xml, gif, and images in transport.
AddOutputFilterByType DEFLATE text/html text/css text/plain text/xml image/gif image/jpeg image/png text/javascript application/javascript application/pdf application/json application/pdf
</IfModule>

<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 month"
# Set expires tags on various file types... so that the browser wont attempt to reload them.
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/ico "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType video/x-flv "access plus 1 year"
ExpiresByType application/pdf "access plus 1 year"
ExpiresByType application/x-shockwave-flash "access plus 1 year"
ExpiresByType application/javascript "access plus 1 month"
ExpiresByType text/javascript "access plus 1 month"
ExpiresByType text/css "access plus 1 month"
<IfModule mod_headers.c>
  # Setting cache control to public allows proxy servers to cache the items too.
  Header set Cache-Control "public"
</IfModule>
</IfModule>

<FilesMatch ".(ttf|otf|eot|woff)$">
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>
</FilesMatch>
I tried to do it by myself but when I put working code which make redirect then my links of the other pages looks:
domain.com/?page=pl/page

Please help :)
User avatar
rotezecke
Power Poster
Power Poster
Posts: 411
Joined: Fri Apr 18, 2008 9:34 pm

Re: Cant remove /index.php from address

Post by rotezecke »

aleksiejs
New Member
New Member
Posts: 2
Joined: Mon Dec 14, 2015 1:17 pm

Re: Cant remove /index.php from address

Post by aleksiejs »

I think that my config.php looks fine:

Code: Select all

<?php
# CMS Made Simple Configuration File
# Documentation: /doc/CMSMS_config_reference.pdf
#
$config['dbms'] = 'mysql';
$config['db_hostname'] = 'xx';
$config['db_username'] = 'xx';
$config['db_password'] = 'xx';
$config['db_name'] = 'xx';
$config['db_prefix'] = 'xx';
$config['timezone'] = 'xx';
$config['url_rewriting'] = 'mod_rewrite';
?>
Any advice how to fix it?
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Cant remove /index.php from address

Post by velden »

Seems it works fine and I don't think you can prevent .../index.php... from working.

It should not be a problem. Duplicate content 'issues' are solved using canonical urls including the link rel="canonical" tag
Post Reply

Return to “The Lounge”