• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS Made Simple Czech CMS Made Simple France CMS Made Simple Spain CMS Made Simple Hungary CMS Made Simple Russia CMS Made Simple Netherlands

All times are UTC




Post new topic Reply to topic  [ 13 posts ] 
Author Message
 Post subject: [SOLVED] Pretty url in v.1.10.3
PostPosted: Mon Feb 13, 2012 10:21 pm 
Offline
Forum Members
Forum Members

Joined: Sun Jan 27, 2008 6:14 pm
Posts: 52
I can't get pretty url's on my site.
I have impression that I've tried every possible combination
of following two files associated with CMSMS and the best result was
nicely rewritten url with 404 page..
Since my brain is now quite "boiled", I would be greatful if someone can take a look please and i hope see something that am missing..

Additional lines in config.php are;
Code:
$config['url_rewriting'] = 'mod_rewrite';
$config['page_extension'] = '/';
$config['use_hierarchy'] = true;
$config['query_var'] = 'page';

and .htaccess file in a site root looks like this;
Code:
Options +FollowSymLinks
  RewriteEngine on
  RewriteBase /
 
  # 301 Redirect all requests that don't contain a dot or trailing slash to
  # include a trailing slash
  # except for form POSTS
  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]



Thanks

CMSMS 1.10.3
Banners 2.5.2
CGBlog 1.8.2
CGExtensions 1.27.7
CGSimpleSmarty 1.4.10
CMSMailer 2.0.2
CMSPrinting 1.0
FileManager 1.2.0
JQueryTools 1.0.10
MenuManager 1.7.7
MicroTiny 1.1.1
ModuleManager 1.5.3
NMS 2.3.8
News 2.12.3
Search 1.7
Showtime 2.0.5
Statistics 1.1.3
ThemeManager 1.1.4
TinyMCE 2.9.5
jQuery 1.2.0


Last edited by surogat on Wed Feb 15, 2012 2:58 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Pretty url in v.1.10.3
PostPosted: Mon Feb 13, 2012 10:25 pm 
Offline
New Member

Joined: Thu Dec 22, 2011 7:52 pm
Posts: 3
Hi, surogat. I'm having the same exact issue as you with the same version of CMSMS. One thing I noticed is that you have a different line than I do in my config:

You have:
Code:
$config['url_rewriting'] = 'mod_rewrite';


and I read elsewhere to use this:
Code:
$config['assume_mod_rewrite'] = true;


I'm not sure which one is correct but neither of them seem to be working anyway :-\


Top
 Profile  
 
 Post subject: Re: Pretty url in v.1.10.3
PostPosted: Mon Feb 13, 2012 11:31 pm 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Fri Nov 30, 2007 9:15 am
Posts: 329
adding
Code:
$config['url_rewriting'] = 'mod_rewrite';

and uncommenting the lines in .htaccess should suffice to get pretty URL's working...

Have you checked your error logs?
If you installed in a subdir, you need to change the "RewriteBase /" accordingly (with a trailing slash)

Greetings,
Manuel


Top
 Profile  
 
 Post subject: Re: Pretty url in v.1.10.3
PostPosted: Tue Feb 14, 2012 12:42 am 
Offline
Forum Members
Forum Members

Joined: Sun Jan 27, 2008 6:14 pm
Posts: 52
@bloqhead it's kind of comforting not to be alone in this darkness :)
@manuel
Well .htaccess, and config.php are just like I wrote, i don't know what's left to uncomment.
But it may be the problem in my server (IIS7.5)..
I've also put web.config from the handbook, but still nothing..

web.config ;
Code:
 <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <configSections>
            <sectionGroup name="system.webServer">
                <sectionGroup name="rewrite">
                    <section name="rewriteMaps" overrideModeDefault="Allow" />
                    <section name="rules" overrideModeDefault="Allow" />
                </sectionGroup>
            </sectionGroup>
        </configSections>
   
        <system.webServer>
            <security>
                <!--  This section should be uncommented after
                installation to secure the installation. -->
                <!--
                <requestFiltering>
                    <denyUrlSequences>
                        <add sequence="engine" />
                        <add sequence="inc" />
                        <add sequence="info" />
                        <add sequence="module" />
                        <add sequence="profile" />
                        <add sequence="po" />
                        <add sequence="sh" />
                        <add sequence="theme" />
                        <add sequence="tpl(\.php" />
                        <add sequence="Root" />
                        <add sequence="Tag" />
                        <add sequence="Template" />
                        <add sequence="Repository" />
                        <add sequence="code-style" />
                    </denyUrlSequences>
                    <fileExtensions>
                        <add fileExtension=".sql" allowed="false" />
                        <add fileExtension=".pl" allowed="false" />
                    </fileExtensions>
                </requestFiltering>
                -->
            </security>
            <directoryBrowse enabled="true" />
        <caching>
                <profiles>
                    <add extension=".php" policy="DisableCache" kernelCachePolicy="DisableCache" />
                    <add extension=".html" policy="CacheForTimePeriod" kernelCachePolicy="CacheForTimePeriod" duration="14:00:00:00" />
                </profiles>
            </caching>
            <rewrite>
                <rules>
                    <rule name="block favicon" stopProcessing="true">
                        <match url="favicon\.ico" />
                        <action type="CustomResponse" statusCode="404" subStatusCode="1"
                            statusReason="The requested file favicon.ico was not found"
                            statusDescription="The requested file favicon.ico was not found" />
                    </rule>
                    <rule name="Imported Rule 2" stopProcessing="true">
                        <match url="^(.*)$" ignoreCase="false" />
                        <conditions>
                            <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="true" negate="true" />
                            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="true" negate="true" />
                <add input="{URL}" pattern="^/favicon.ico$" ignoreCase="false" negate="true" />
                        </conditions>
                        <action type="Rewrite" url="index.php?page={R:1}" appendQueryString="true" />
                    </rule>
                </rules>
            </rewrite>
            <defaultDocument>
                <files>
                    <remove value="index.php" />
                    <add value="index.php" />
                </files>
            </defaultDocument>
   
            <!-- HTTP Errors section should only be enabled if the "Error Pages"
            feature has been delegated as "Read/Write" at the Web Server level.        -->
               <httpErrors>
                   <remove statusCode="404" subStatusCode="-1" />
                   <error statusCode="404" prefixLanguageFilePath="" path="/index.php" responseMode="ExecuteURL" />
               </httpErrors>
   
   
        </system.webServer>
    </configuration>

i guess am not smart enough :-\ tnx


Top
 Profile  
 
 Post subject: Re: Pretty url in v.1.10.3
PostPosted: Tue Feb 14, 2012 4:29 am 
Offline
Power Poster
Power Poster
User avatar

Joined: Sat Jul 12, 2008 3:50 am
Posts: 275
Location: Zeist, Netherlands
I'm no expert in .htaccess, but recently I learned that the [L] flag means: last line to read an execute. Which means after
Code:
RewriteRule ^(.*) %{REQUEST_URI}/ [R=301,L]

nothing will be processed.
So move the L to the last line you want to have executed.

See http://httpd.apache.org/docs/2.2/rewrite/flags.html for reference.

Frank


Top
 Profile  
 
 Post subject: Re: Pretty url in v.1.10.3
PostPosted: Tue Feb 14, 2012 2:18 pm 
Offline
Forum Members
Forum Members

Joined: Sun Jan 27, 2008 6:14 pm
Posts: 52
@frank
Code:
RewriteRule ^(.*) %{REQUEST_URI}/ [R=301,L]

is from here
http://wiki.cmsmadesimple.org/index.php ... And_Tricks
and here;
http://wiki.cmsmadesimple.org/index.php ... l_Settings
If it's not outdated..


Top
 Profile  
 
 Post subject: Re: Pretty url in v.1.10.3
PostPosted: Tue Feb 14, 2012 5:03 pm 
Offline
Power Poster
Power Poster
User avatar

Joined: Sat Jul 12, 2008 3:50 am
Posts: 275
Location: Zeist, Netherlands
Yes, but did you try it?


Top
 Profile  
 
 Post subject: Re: Pretty url in v.1.10.3
PostPosted: Tue Feb 14, 2012 6:36 pm 
Offline
Administrator
Administrator
User avatar

Joined: Thu Mar 09, 2006 5:32 am
Posts: 11812
Location: Arizona
Windows servers most times don't allow pretty URLs unless you know some trick others don't know about...

_________________
Extensions » Modules/Tags click the name of the module/tag or Help to the right to get its parameters.
Right click and view source is a great way to see what you have to work with.
Check ver. CMSMS, PHP, server OS, in System Information page.
Default content http://multiintech.com/defaultcontent/
People are Wonderful
Business is Great
Life is Terrific
Ever wonder what happened to the Album module? Well it is alive and well.
http://album.multiintech.com/
Image


Top
 Profile  
 
 Post subject: [SOLVED] Pretty url in v.1.10.3
PostPosted: Wed Feb 15, 2012 2:51 pm 
Offline
Forum Members
Forum Members

Joined: Sun Jan 27, 2008 6:14 pm
Posts: 52
The trick is to have these 3 things in your root directory;

1. additional lines in config.php
Code:
$config['url_rewriting'] = 'mod_rewrite';
$config['page_extension'] = '/';
$config['use_hierarchy'] = false;
$config['query_var'] = 'page';


2. .htaccess file (the one from /doc folder, renamed htaccess.txt)

Code:
# 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

#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 /

# 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_header.c>
# Disable ETags
Header unset ETag
FileEtag None
</IfModule>

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

<IfModule mod_expires.c>
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
# Set expires tags on various files... so that the browser wont attempt to reload them.
ExpiresActive On
ExpiresDefault "access plus 1 year"
<IfModule mod_header.c>
  # Setting cache control to public allowes proxy servers to cache the items too.
  Header set Cache-Control "public"
</IfModule>
</FilesMatch>
</IfModule>


and 3. web.config file (needed for IIS (7.5 in may case) interpretation of .htaccess)
Code:
<?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <configSections>
            <sectionGroup name="system.webServer">
                <sectionGroup name="rewrite">
                    <section name="rewriteMaps" overrideModeDefault="Allow" />
                    <section name="rules" overrideModeDefault="Allow" />
                </sectionGroup>
            </sectionGroup>
        </configSections>
   
        <system.webServer>
            <security>
                <!--  This section should be uncommented after
                installation to secure the installation. -->
                <!--
                <requestFiltering>
                    <denyUrlSequences>
                        <add sequence="engine" />
                        <add sequence="inc" />
                        <add sequence="info" />
                        <add sequence="module" />
                        <add sequence="profile" />
                        <add sequence="po" />
                        <add sequence="sh" />
                        <add sequence="theme" />
                        <add sequence="tpl(\.php" />
                        <add sequence="Root" />
                        <add sequence="Tag" />
                        <add sequence="Template" />
                        <add sequence="Repository" />
                        <add sequence="code-style" />
                    </denyUrlSequences>
                    <fileExtensions>
                        <add fileExtension=".sql" allowed="false" />
                        <add fileExtension=".pl" allowed="false" />
                    </fileExtensions>
                </requestFiltering>
                -->
            </security>
            <directoryBrowse enabled="true" />
        <caching>
                <profiles>
                    <add extension=".php" policy="DisableCache" kernelCachePolicy="DisableCache" />
                    <add extension=".html" policy="CacheForTimePeriod" kernelCachePolicy="CacheForTimePeriod" duration="14:00:00:00" />
                </profiles>
            </caching>
            <rewrite>
                <rules>
                    <rule name="block favicon" stopProcessing="true">
                        <match url="favicon\.ico" />
                        <action type="CustomResponse" statusCode="404" subStatusCode="1"
                            statusReason="The requested file favicon.ico was not found"
                            statusDescription="The requested file favicon.ico was not found" />
                    </rule>
                    <rule name="Imported Rule 2" stopProcessing="true">
                        <match url="^(.*)$" ignoreCase="false" />
                        <conditions>
                            <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="true" negate="true" />
                            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="true" negate="true" />
                <add input="{URL}" pattern="^/favicon.ico$" ignoreCase="false" negate="true" />
                        </conditions>
                        <action type="Rewrite" url="index.php?page={R:1}" appendQueryString="true" />
                    </rule>
                </rules>
            </rewrite>
            <defaultDocument>
                <files>
                    <remove value="index.php" />
                    <add value="index.php" />
                </files>
            </defaultDocument>
   
            <!-- HTTP Errors section should only be enabled if the "Error Pages"
            feature has been delegated as "Read/Write" at the Web Server level.        -->
               <httpErrors>
                   <remove statusCode="404" subStatusCode="-1" />
                   <error statusCode="404" prefixLanguageFilePath="" path="/index.php" responseMode="ExecuteURL" />
               </httpErrors>
        </system.webServer>
    </configuration>


and it works..


Top
 Profile  
 
 Post subject: Re: [SOLVED] Pretty url in v.1.10.3
PostPosted: Thu Feb 16, 2012 7:54 am 
Offline
New Member

Joined: Thu Feb 16, 2012 12:10 am
Posts: 5
I have just tried this to no success. The code seems to change the links to the correct urls, however the pages do not load. Says they cannot be found.


Top
 Profile  
 
 Post subject: Re: [SOLVED] Pretty url in v.1.10.3
PostPosted: Fri Feb 17, 2012 1:04 pm 
Offline
Power Poster
Power Poster

Joined: Wed Jul 04, 2007 3:39 pm
Posts: 291
Windows servers should use the internal pretty url method. Read the configuration PDF in the docs folder.


Top
 Profile  
 
 Post subject: Re: [SOLVED] Pretty url in v.1.10.3
PostPosted: Sat Feb 18, 2012 10:37 am 
Offline
Forum Members
Forum Members

Joined: Sun Jan 27, 2008 6:14 pm
Posts: 52
Scud wrote:
I have just tried this to no success. The code seems to change the links to the correct urls, however the pages do not load. Says they cannot be found.


Is your site on IIS server?
And if it is, did you make web.config file?


Top
 Profile  
 
 Post subject: Re: [SOLVED] Pretty url in v.1.10.3
PostPosted: Mon Mar 26, 2012 7:20 pm 
Offline
New Member

Joined: Fri Feb 10, 2012 5:41 pm
Posts: 6
Scud wrote:
I have just tried this to no success. The code seems to change the links to the correct urls, however the pages do not load. Says they cannot be found.


I can't seem to get pretty URLs to work like I think they are supposed to. .htaccess seems to work fine, http://www.example.com/a/b/c/ is nicely converted to http://www.example.com/index.php?page=/a/b/c/ (a fact that doesn't show up in the browser address bar of course, but $_GET['page'] == '/a/b/c/').

Also, the routemanager is doing its work properly. If, for example, my module registers a route that reads 'param_a/param_b/param_c/', $_REQUEST['cntnt01param_a'] will be 'a', $_REQUEST['cntnt01param_b'] will be 'b' and so on.

But my module is not receiving these same parameters as $params['param_a'].

What can possibly go wrong?

@Scud: In your case, did $_REQUEST contain the params from the pretty URL? If so and if you solved this, how?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
A2 Hosting