My mod_rewrite will not work and can not solve the problem. Any ideas what am I doing wrong?
My mod_rewrite
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/([^/.]+)/?$ index.php?g=$1 [L]
My CSS File is linked like below
<head>
<link type="text/css" href="/includes/libs/minify/index.php?g=responsive.css&319" rel="stylesheet" media="screen" />
</head>
I want to change it with mod_rewrite to
<head>
<link type="text/css" href="responsive.css" rel="stylesheet" media="screen" />
</head>
Related
.htaccess code it's working fine on local host but it's not working fine on godaddy server. I tried so many .htaccess codes but I am unable to solve the problem.
RewriteEngine On
RewriteBase /CI/
#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#When your application folder isn't in the system folder
#This snippet prevents user access to the application folder
#Submitted by: Fabdrol
#Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin
ErrorDocument 404 /index.php
</IfModule>
Verify your .htaccess path firt
it should be in root directory of your project
and try this below htaccess code , its works for my on godaddy.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /CI/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
Now open /application/config/config.php and do the following changes :
$config['base_url'] = 'http://www.rcshoper.com/CI/';
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';
None of .htaccess file worked for me then i made a web.config file and pasted below code there and then i uploaded that file inside of CI root folder then it worked for me.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Rewrite" url="index.php?url={R:1}" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
I followed the latest Angular 2.0 quickstart guide and everything is up to date. My application runs fine locally using lite-server, but all of my CSS and JS resources get 404 errors when I run it on WAMP. The index.html application page is the only thing that loads.
My folder structure is:
my-project/
application/
views/
pages/
app/
assets/
css/
reset.css
node-modules/
index.html head:
<head>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="assets/css/reset.css" />
<link rel="stylesheet" type="text/css" href="assets/css/main.css" />
<link rel="stylesheet" type="text/css" href="assets/css/menu.css" />
<!-- 1. Load libraries -->
<!-- Polyfill(s) for older browsers -->
<script src="node_modules/core-js/client/shim.min.js"></script>
<script src="node_modules/zone.js/dist/zone.js"></script>
<script src="node_modules/reflect-metadata/Reflect.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
<!-- 2. Configure SystemJS -->
<script src="systemjs.config.js"></script>
<script>
System.import('app').catch(function(err){ console.error(err); });
</script>
</head>
Thanks.
I have tried with following code.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
I have replaced with blank in config file index_page but still not working and getting this error.
404 - File or directory not found.
The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.
Please help me to sort out this.
I have solved the problem. I have made web.config in root directory of codeigniter. My Code is following.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Rewrite" url="index.php?url={R:1}" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
It is working for me. I hope this will help others too.
place your .htaccess file within your codeiginter project directory then write this code in .htaccess
RewriteEngine on
RewriteCond $1 !^(index\.php|[Javascript / CSS / Image root Folder name(s)]|robots\.txt)
RewriteRule ^(.*)$ project_dir_name/index.php/$1 [L]
Replace "project_dir_name" with you actual directory name in 3rd line.
If still you have problem then check your controller, method name and permission of folders and files.
Here is the POM file
<dependency>
<groupId>org.primefaces.extensions</groupId>
<artifactId>all-themes</artifactId>
Web.xml
<context-param>
<param-name>primefaces.THEME</param-name>
<param-value>aristo</param-value>
On the main page http://localhost/helloworld/search.faces primefacs theme loads fine
Generated Page with primefaces style sheet is
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
<html xmlns="http://www.w3.org/1999/xhtml"><head><link type="text/css" rel="stylesheet" href="/helloworld/javax.faces.resource/theme.css.faces?ln=primefaces-aristo" /><link rel="stylesheet" media="screen" type="text/css" href="/helloworld/javax.faces.resource/primefaces.css.faces?ln=primefaces&v=5.0" /><script type="text/javascript" src="/helloworld/javax.faces.resource/jquery/jquery.js.faces?ln=primefaces&v=5.0"><!--
//--></script><script type="text/javascript" src="/helloworld/javax.faces.resource/primefaces.js.faces?ln=primefaces&v=5.0"><!--
//--></script><script type="text/javascript" src="/helloworld/javax.faces.resource/jquery/jquery-plugins.js.faces?ln=primefaces&v=5.0"><!--
//--></script>
but when I access subsequent pages which is one folder down
http://localhost/helloworld/app/welcome.faces, theme is not applied. Url generated for the theme file is adding the extra folder which is in the url and thus not able to find the theme file resulting in theme not getting loaded. What should I do for the extra folder to not get added to the for the primefaces theme url...
generated page is
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
<html xmlns="http://www.w3.org/1999/xhtml"><head><link type="text/css" rel="stylesheet" href="/helloworld/app/javax.faces.resource/theme.css?ln=primefaces-aristo" /><link rel="stylesheet" media="screen" type="text/css" href="/helloworld/app/javax.faces.resource/primefaces.css?ln=primefaces&v=5.0" /><script type="text/javascript" src="/helloworld/app/javax.faces.resource/jquery/jquery.js?ln=primefaces&v=5.0"><!--
//--></script><script type="text/javascript" src="/helloworld/app/javax.faces.resource/jquery/jquery-plugins.js?ln=primefaces&v=5.0"><!--
//--></script><script type="text/javascript" src="/helloworld/app/javax.faces.resource/primefaces.js?ln=primefaces&v=5.0"><!--
//--></script>
code
There is no theme related code in xhtml... mentioned in web.xml and all- themes in POM file.
welcome.xhtml and search.xhtml are the same and here is the snippet
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui"
template="/WEB-INF/layouts/standard.xhtml">
<ui:define name="title">
</ui:define>
standard.xhtml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<f:view contentType="text/html">....
Summary of the problem
If the url is /helloworld/search.faces generated in the page is /helloworld/javax.faces.resource/primefaces.js.faces?ln=primefaces&v=5.0" ... and theme loads fine.
When the url is ( is one folder deep) theme does not load /helloworld/app/welcome.faces path generated is in the page is href="/helloworld/app/javax.faces.resource/theme.css?ln=primefaces-aristo ... see the app directory that is added.... This is causing 404 erros for this resouce as it is not able to find it.
Is there a way to control the generated primefaces theme path ?
Upon further digging thro the rest of the config files. Added the following line to servlet context.
<!-- Enable processing of JSF 2 resource requests. For example: /webflow-primefaces-showcase/app/javax.faces.resource/jsf.js?ln=javax.faces -->
<faces:resources />
and now the theme is getting applied without any issues. Thanks for all those who chimed in.
I am trying to create a template.I have created a folder for template in templates folder and also created two files index.php and templateDetails.xml
My index.php has following code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" >
<head>
<jdoc:include type="head" />
</head>
<body>
<jdoc:include type="component" />
</body>
</html>
and templateDetails.xml has following code which yes I copied because beginner.
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE install PUBLIC "-//Joomla! 1.5//DTD template 1.0//EN"
"http://dev.joomla.org/xml/1.5/template-install.dtd">
<install version="3.1.5" type="template">
<name>template _tut</name>
<creationDate>31-01-2009</creationDate>
<author>Nettut Fan</author>
<authorEmail>your#email.com</authorEmail>
<authorUrl>http://www.siteurl.com</authorUrl>
<copyright>You 2009</copyright>
<license>GNU/GPL</license>
<version>1.0.0</version>
<description>Template Tut</description>
<files>
<filename>index.php</filename>
<filename>templateDetails.xml</filename>
<filename>css/template.css</filename>
</files>
<positions>
<position>breadcrumb</position>
<position>left</position>
<position>right</position>
<position>top</position>
<position>user1</position>
<position>user2</position>
<position>user3</position>
<position>user4</position>
<position>footer</position>
</positions>
</install>
My joomla version is 3.1.5 and despite doing above mentioned steps my template folder is not showing in template manager.
You need to install the template to register it completely.
There are 2 ways of doing this:
Download your files, zip them up and install it as you would any other extension.
In the Joomla backend, go to "Extension Manager", then "Discover". This will detect uninstalled extensions and should bring your template up in the list. check it and install it
Hope this helps