Quick links: Content - sections - sub sections
EN FR
Quick Search Advanced search
 
Page

  [Opened] Removing module name in the URL

Posted by richard_sma on 02/12/2015 23:45

Hi, there, I am working on cleaning the URLs. I have removed "index.php" in the URL, now the URLs look like

http://www.example.com/aaa/bbb/ccc

aaa is a module. Since aaa is the only module in my jelix app, is it possible to make the URLs look like

http://www.example.com/bbb/ccc

Thanks, Richard

  [Opened] Removing module name in the URL

Reply #1 Posted by laurentj on 02/13/2015 09:06

Hi,

Did you use the rewrite rules in apache ?

If so, you certainly configured something like that, as indicated into the manual:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L,QSA]
</IfModule>

If so, just add aaa in the RewriteRule:

    RewriteRule ^(.*)$ index.php/aaa/$1 [L,QSA]

  [Opened] Removing module name in the URL

Reply #2 Posted by richard_sma on 02/16/2015 00:07

Thank you! It works. However, I just found another problem. This is because I also use jauth in my application, so when login as a user, jAuth::isConnected() always return false or $user = jAuth::getUserSession() doesn't work at all.

I suppose jAuth is a module, but my rewrite rules break it.Is there any method to add an exception? I tried to add

RewriteCond %{REQUEST_URI} !^jauth$

in the condition part, but it didn't work.

  [Opened] Removing module name in the URL

Reply #3 Posted by laurentj on 02/18/2015 09:35

I'm not an expert in rewrite rules. Try to ask in an other forum.

Or you can use the significant url engine. So you can define the url you want for each action. However you have to define urls for all actions. For jauth modules and other jelix modules, you can include their urls.xml.

 
Page
  1. Removing module name in the URL