[solved] - nice url - .htacces

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
Post Reply
honza
Posts: 8
Joined: Wed 11. Apr 2012, 12:39

[solved] - nice url - .htacces

Post by honza » Thu 6. Jun 2013, 08:46

I need advice please with the rules for .htacces.

I want to have a format url
url: http://www.domain.com/page
url: http://www.domain.com/category/article

With this setting, the pages are displayed corect, BUT:
1. Do not load the images
2. I can not log in to the administration: / login.php - shows the home page

My settings conf:

Code: Select all

$phpwcms['rewrite_url'] = 1;
$phpwcms['rewrite_ext'] = ''; 
$phpwcms['alias_allow_slash'] = 1;
My settings .htacces

Code: Select all

# Installed in Document Root www.example.com/
	RewriteRule ^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)$ /index.php?id=$1,$2,$3,$4,$5,$6&%{QUERY_STRING}
	RewriteRule ^(.+)$ /index.php?$1&%{QUERY_STRING}

# Installed in Subfolder www.example.com/subfolder/
#	RewriteRule ^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)$ /subfolder/index.php?id=$1,$2,$3,$4,$5,$6&%{QUERY_STRING}
#	RewriteRule ^(.+)$ /subfolder/index.php?$1&%{QUERY_STRING}
Can someone please help me with .htacces rules?

thanks

honza

honza
Posts: 8
Joined: Wed 11. Apr 2012, 12:39

Re: [solved] - nice url - .htacces

Post by honza » Thu 13. Jun 2013, 08:58

correct settings .htacces

Code: Select all

# Ignore
	RewriteRule $1 !^(include|img|template|picture|filearchive|content|robots\.txt|favicon\.ico)
	RewriteRule ^index\.php$ - [L]

	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteCond %{REQUEST_FILENAME} !-d
	
	

# Installed in Document Root www.example.com/
	RewriteRule ^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)$ /index.php?id=$1,$2,$3,$4,$5,$6&%{QUERY_STRING}
	
#add again...
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteCond %{REQUEST_FILENAME} !-d
	RewriteRule ^(.+)$ /index.php?$1&%{QUERY_STRING}


honza
Posts: 8
Joined: Wed 11. Apr 2012, 12:39

Re: [solved] - nice url - .htacces

Post by honza » Fri 21. Jun 2013, 11:58

my settings .htaccess for url format with "/" on end of url.

Code: Select all

http://www.domain.com/test/, http://www.domain.com/test/subcategory
http://www.domain.com/test - redirect (301) to http://www.domain.com/test/
48.row - conf.inc.php:

Code: Select all

$phpwcms['rewrite_ext'] = '/'; // The file extension used while URL is rewritten

.htacces

Code: Select all

#Sometimes neccessary to add those
#	AddType application/x-javascript .js
#	AddType text/css .css

# Options:
#	Options +FollowSymlinks
#	AcceptPathInfo On

# Rewrite:
<IfModule mod_rewrite.c>

	RewriteEngine On

	DirectoryIndex index.html index.php 
	RewriteCond %{HTTP_HOST} ^domain\.com [nc]
	RewriteRule (.*) http://www.domain.com/$1 [R=301,L]
	
	RewriteCond %{THE_REQUEST} ^.*/index.php
	RewriteRule ^(.*)index.php$ http://www.domain.com /$1 [R=301,L]
	
	RewriteRule sitemap\.xml sitemap.php [L]
	
#add "/" to end url, when isn't
	RewriteCond %{REQUEST_URI} !\.[[:alnum:]]+$ 
	RewriteRule ^(.+[^/])$ /$1/ [R=301,L]
	
	
# Use RewriteBase - always start in Document Root
# If installed in subfolder see the ReWrite Rule section
	RewriteBase /

# Ignore
	RewriteRule $1 !^(include|img|template|picture|filearchive|content|robots\.txt|favicon\.ico)
	RewriteRule ^index\.php$ - [L]

	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteCond %{REQUEST_FILENAME} !-d

# Installed in Document Root www.example.com/
	RewriteRule ^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)$ /index.php?id=$1,$2,$3,$4,$5,$6&%{QUERY_STRING}
	
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteCond %{REQUEST_FILENAME} !-d
	RewriteRule ^(.+)\/$ /index.php?$1&%{QUERY_STRING}

# Installed in Subfolder www.example.com/subfolder/
#	RewriteRule ^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.html$ /subfolder/index.php?id=$1,$2,$3,$4,$5,$6&%{QUERY_STRING}
#	RewriteRule ^(.+)\.html$ /subfolder/index.php?$1&%{QUERY_STRING}
</IfModule>

User avatar
juergen
Moderator
Posts: 4549
Joined: Mon 10. Jan 2005, 18:10
Location: Weinheim
Contact:

Re: [solved] - nice url - .htacces

Post by juergen » Sat 22. Jun 2013, 05:32

For some Link resaons I changed the way of the above http entry into a code Entry.

Seems your solution is "a good to know" an will pin this up

Jürgen

Post Reply