Koozali.org: home of the SME Server

Joomla 3.x in SME 9.1 > How to hide 'index.php' using 'Template Fragment'?

Offline festus

  • ***
  • 43
  • +0/-0
a) In Joomla Config set:

Search Engine Friendly URLs to Yes,

Use Apache mod_rewrite to Yes.

b) Browse to 'templates-custom' directory

/etc/httpd/conf/httpd.conf
cd /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf
# ls
20LoadModule80PHP

c) Create a template fragment '50RedirectRewriteDirective'

# nano 50RedirectRewriteDirective

d) Make the following entries in the fragment
(Ref: https://wiki.contribs.org/Htaccess)

Quote
<Directory /home/e-smith/files/ibays/pchurch/html>
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
</Directory>

e) Save and exit

f) Expand Template

# expand-template /etc/httpd/conf/httpd.conf

g) Restart apache service

# service httpd-e-smith restart

After this my joomla pages in ibay 'pchurch' cannot be seen.

Would appreciate some advise.
« Last Edit: June 19, 2017, 04:20:48 AM by festus »

Offline janet

  • *****
  • 4,812
  • +0/-0
Please search before asking, an answer may already exist.
The Search & other links to useful information are at top of Forum.

Offline festus

  • ***
  • 43
  • +0/-0
Hello Janet,

I followed only the fragment as per:
https://wiki.contribs.org/Htaccess#Basic_layout_of_fragment_for_a_redirect_rewrite_directive

I did not have an empty line at the end of the fragment.

I notice there are three dots as the last line. (...)
Am I supposed to add these three dots as the last line before </Directory> ??

Also I do not see any 'empty line' at the end of the template fragment for:
https://wiki.contribs.org/Htaccess#Authentication_against_a_user_password_file
I am not using this in any case, since all I need is the mod-rewrite to be enabled so that I can hide 'index.php' in the url.

-------------------------

To update:
I tried having an empty line before </Directory>
and I also tried inserting ... (three dots) before </Directory>

Both of these configurations 'break the site' and no page is displayed.

« Last Edit: June 19, 2017, 12:59:26 PM by festus »

Offline janet

  • *****
  • 4,812
  • +0/-0
festus

at the end means the next line after
</Directory>

Please search before asking, an answer may already exist.
The Search & other links to useful information are at top of Forum.

Offline festus

  • ***
  • 43
  • +0/-0
Yes indeed.
I do have a blank line after </Directory>

Would appreciate example from anyone who has successfully configured this using template fragment.
« Last Edit: June 20, 2017, 03:25:16 AM by festus »

Offline festus

  • ***
  • 43
  • +0/-0
Hello,

I am sure someone in the community will have some advise on the basic problem I am stuck with. I have followed whatever document I can find in the Contribs sites. Not sure what else I can try. Hope one of the experts in the community will be able to pay some attention to this problem and propose a solution....

Offline festus

  • ***
  • 43
  • +0/-0
After searching for a solution for nearly a week, and trying out all possible configurations referring to various posts, I had no choice but to give up for now. It is quite disappointing that I could not find a solution using template although I have been using SME server for many years and have made SME server to build many solutions. I have no choice but to use the .htaccess file in the ibay as per following document:

Quote
https://wiki.contribs.org/Htaccess#Using_a_.htaccess_file_to_configure_htaccess_requirements_-_not_recommended

I have even tried out the template approach using another SME 9.2 server and encountered the same problems.
Hopefully someday, somebody in the community will be able to simulate the problem and provide a 'verified working solution' with clear documentation that works with latest versions of sme.

Offline janet

  • *****
  • 4,812
  • +0/-0
festus

So what did you put in the .htaccess file in the ibay & what other configuration setting changes did you make to sme server
eg db commands or whatever,
 & did that all achieve the result you were after ?
Please elaborate on what you were trying to achieve.
Please search before asking, an answer may already exist.
The Search & other links to useful information are at top of Forum.

Offline festus

  • ***
  • 43
  • +0/-0
Hi Janet,

Thanks for trying to help find a solution.

My objective has been to hide 'index.php' in the url, preferably using template fragment to make the changes in the core httpd.conf file rather than to use .htaccess in the joomla ibay. In sme forums it is always advised against using .htaccess in the ibay to make the changes. Since my attempt over a period of 1 week failed, I had to resort to making use of .htaccess.

I followed the instruction as given at following url and my objective has been achieved:

Quote
https://wiki.contribs.org/Htaccess#Using_a_.htaccess_file_to_configure_htaccess_requirements_-_not_recommended

Quote
db accounts setprop ibayname AllowOverride All
expand-template /etc/httpd/conf/httpd.conf
service httpd-e-smith restart

Quote
Rename htaccess.txt in ibay to '.htaccess'

That is all I had to do.
And since I am using .htaccess, I have to go ahead to add on various recommendation for securing joomla.

Offline janet

  • *****
  • 4,812
  • +0/-0
festus

My guess is that the contents of the template fragment are not what you want/need.
This google search has a different .htaccess file content than that shown in the wiki article your refer to.
Maybe try changing the template fragment content.
https://www.yireo.com/tutorials/joomla/joomla-administration/1338-get-rid-of-indexphp-in-your-joomla-urls

Note the conditions/directives & so on referred to in the .htaccess file are what you would be putting into the template fragment.
If it works in the .htaccess file, then it should work the same in the template fragment, as long as you implemented it correctly eg correct order, correct location etc.

The example you used from the wiki article was exactly that, an example, & may not suit your specific needs.

There are many search results on google for your issue.

Now:
What are the contents of the .htaccess file ?
Is this the default .htaccess file that Joomla provides ?
I assume you are following the generic instructions that Joomla advises, in order to hide or obscure or remove the index.php name from the URL.
Is that correct & is that what you want to achieve ?
ie is that what you mean by asking "How to hide index.php" ?

« Last Edit: June 23, 2017, 09:23:51 AM by janet »
Please search before asking, an answer may already exist.
The Search & other links to useful information are at top of Forum.