.htaccess

How to keep same stylesheets and scripts url for seo friendly and non friendly url's using php

Hello, I am using php to develop an application, i have different set of url's if seo is enabled and different set if seo is disabled. ex: SEO Enabled = hxxp://www.website.com/page/about_us SEO Disabled = hxxp://www.website.com/page.php?about_us Stylesheet url = hxxp://www.website.com/style.css The problem is If seo is disabled i h...

RewriteCond/RewriteRule with case-insensitive and trailing slash functionality?

Hi! I got problems with the following two lines: RewriteCond %{REQUEST_FILENAME}.html -f RewriteRule ^(.+[^/])$ /$1.html [L] Goal: Redirecting "domain.tld/test/" (only if test.html exists) so that it outputs the contents of "domain.tld/test.html". How to make this case-insensitive: "domain.tld/Test" -> domain.tld/test.html ** How to...

mod_rewrite prefix problem

Hello, I'm having some difficulties with mod_rewrite. My directory structure (part of it) is: index.php .htaccess app controllers models views ... public javascripts stylesheets foo bar So, as you can see, all static files are in app/public. That's the reason I would like to route requests like: http://...

How do I make .htaccess do what I want? :) (appending query string to url)

Currently my .htaccess looks like this... Options +FollowSymLinks RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ $1.php [L,QSA] It currently changes any /xxx.php file into /xxx. This is great for SEO. However, I also want Mr. htaccess to convert certain ...

.htaccess - create a language dir

For SEO friendly urls i'm using this expression: RewriteRule ^([0-9]+).([^/]+)$ index.php?id=$1&titel=$2 The url is domain.com/55-page-title and it works perfect. Now i have to determine different languages and my url should look like domain.com/de/55-seitentitel. I've no idea how to rewrite regular expression in .htaccess file. Rew...

Problems with Wordpress’ mod_rewrite rules when requesting existing files

Hey guys, please take a look at my .htaccess: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L] RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L] RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L] Rewri...

How to modify .htaccess to expose file at specific location on site already hosting wordpress installation?

Hi, I agreed to host a file for an online community, but I've since changed my site around so that it's now hosting a wordpress blog. What I'd like is to not break the existing URL to this one file, so, for example, when people navigate to the URL where file is being hosted, e.g. myblog.com/path/to/file, I'd like Apache to handle the UR...

Setting htaccess parameters from PHP code

I have several files in a directory that require different types of authentication. For authentication we use cosign which means we have to define the user groups or users that have access to a directory in an .htaccess file. Is there a way that in my PHP code I can define different rules? I need to set a rule like Require user bjensen. ...

rewrite url issue

Hey, I'd like to know why the following htaccess file produces a 500 error: <IfModule !mod_rewrite.c> ErrorDocument 500 "Your_Server_Is_Not_Compatible: Apache does not have mod_rewrite loaded. Please check your Apache setup." RedirectMatch 302 .* index.php </IfModule> <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^(...

Is it a bad idea to have set my website up like so?

I was thinking of setting up my website with a file called master.php and using .htaccess and URL rewriting I would transform http://mysite.com/About into http://mysite.com/master.php?selected=About Which would allow me to setup the about page. Is it a bad idea to have one master page that creates dynamic pages? ...

apache url rewrite on .htaccess

I need to figure out the code on my .htaccess for the following. Redirect url http://www.mydomain.com/somekw to http://www.mydomain.com/differentkw also http://www.mydomain.com/somekw?sort=rating&amp;order=ASC to http://www.mydomain.com/differentkw I have read up about .htaccess but I have very little skills, hopefully someone can he...

.htaccess a specific folder is not rewriting

There is something strange going on. I am using Zend Framework on a subfolder in a site. I have a modular structure to my website, so the links consist of module names (www.xx.com/modulename). I have created a .htaccess file for the root dir, so that all of the requests would be routed to the public dir. When i try to access the homepa...

Dynamic subdomain with .htaccess and php

I have a page like index.php?username=thurein i need to get with subdomain like thurein.mydomain.com how could i get it? ...

PHP/APACHE: can i auto_prepend to a .js file?

I'd like to auto_prepend_file all my js files with: var SITE_ROOT = 'http://www.mydomain.com'; Can this be done in .htaccess like it can for php files, if so, how?!!! ...

Wordpress, .htaccess and mod_rewrite: how can I add redirection rules?

At the moment, I have a standard installation of Wordpress 3.0, and the .htaccess file looks like this: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> I want to rewrite URLs so that I...

Multilanguage site, subdirectories as language (RewriteRule)

Hi all, For my website i want to rewrite my url to: www.xxx.com/en/index.php instead of www.xxx.com/index.php?language=en www.xxx.com/nl/index.php instead of www.xxx.com/index.php?language=nl www.xxx.com should be www.xxx.com/en/ This actually works i have added these rewrite rules RewriteCond %{HTTP_HOST}%{REQUEST_URI} ^www\...

Where should I place downloadable files for my component?

I am developing a Joomla Component which will allow visitors to download a sound file (be it mp3, or wave, does not matter). Those files are managed in the admin interface and can be unpublished in there. Therefore, it seems that placing them in the assets section is not an option, as it would make them accessible directly from the serv...

Temporary redirect 302 with .htaccess and mod-rewrite matching expression

Hi! I'm trying to match a a bunch of redirects for my website with basically moved to a different folder on the server. I need to make http://www.site.com/index.php?page=anypage go to http://www.site.com/newfolder/index.php?page=anypage. The thing is http://www.site.com/index.php and http://www.site.com/index.php?page=home should remain ...

How to modify .htaccess

When I link to a file in a directory, I want to open that file as a param in a php program. For example, I have a directory temp, and files aa.txt, bb.txt, and test.php. When I link to aa.txt it should be handled like test.php?f=aa.txt. What do I change in the .htaccess file? the code in the test.php <?php $f=$_GET['f']; if(@file_exi...

Working with htaccess files on Windows - actually save file as .htaccess?

When working with htaccess files on Windows, is it possible to save the file as .htaccess ? (Rather than having to rename on LAMP server) ...