RewriteEngine On
RewriteRule ^([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)$ index.php?p=$1&l=$2
RewriteRule ^([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/$ index.php?p=$1&l=$2
this works fine if I do site.com/param_one/param_two/, but returns a 404 when I omit param_two. I'm a newbie to routing requests with htaccess, is there a simple quick fix?
...
I have what I originally assumed to be a simple problem. I am using shared hosting for my website (so I don't have access to the Apache configuration) and have only been given a single folder to store all my content in. This is all well and good but it means that all my subdomains must have their virtual document root's inside public_htm...
I created a file .htaccess in the /var/www directory. The rights are "root root --wxrwxrwxr".
The content of the file is:
Options +FollowSymlinks
RewriteEngine on
RewriteLogLevel 3
RewriteLog "/var/log/apache2/rewrite.log"
RewriteRule ^(.*?)$ testphp.php
When I call the page phpinfo.php, I've got: Loaded Modules ... mod_rewrite ...
...
Hi everyone
Currently developing a multi-lingual website, Users can access the front page using URL with format below:
http://example.com/en/
http://example.com/fr/
Problem is here. URL without last "/" (http://example.com/fr) caused page not found problem
Here is the rule
RewriteRule ^/?([^./]+)/(.*)$ $2?lang=$1 [L,QSA]
Can anyb...
Hello.
What I'm trying to do:
have pretty URLs in the format 'http://domain.tld/one/two/three', that get handled by a PHP script (index.php) by looking at the REQUEST_URI server variable.
In my example, the REQUEST_URI would be '/one/two/three'. (Btw., is this a good idea in general?)
I'm using Apache's mod_rewrite to achieve that.
Her...
Hello,
I've been trying to figure out a way to redirect requests for wildcard subdomains to a specific folder ( called 'core' ) and calling the requested page/file from that specific folder. For example,
making all calls to -http://johnny5.mysite.net redirect to -http://mysite.net/core/, or -http://docholliday.mysite.net/login.php redir...
How do I interpolate values like %{REQUEST_FILENAME} in the TestString part of a RewriteCond directive? Here's what I'm trying to do:
# non-existent requests to /webroot files get 404'd
RewriteCond site/%{REQUEST_FILENAME} !-f
RewriteRule ^/?webroot site/webroot/404 [L]
# otherwise, let them in!
RewriteRule ^/?webroot/(.*)$ site/webroot...
Using .htaccess, how do I permanently redirect all not found *.flv files in one directory to a 404.flv file in the same directory. For example:
If this file is not found:
example.com/flv/*.flv
Use this file:
example.com/flv/404.flv
Here's what I have so far (I'm very bad):
RewriteCond /flv/(.*).flv !-f
RewriteRule ^ /flv/404.flv [L,R...
My site is a php based site, but I've added wordpress in a /blog/ folder. The .htaccess file below should allow the /blog/ folder to be accessed, but I get a 404 error saying that blog.php doesn't exist.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !\.(gif|jpg|png)$
RewriteCond %{REQUEST_FILENA...
I put an .htaccess file in my webroot with the following contents
RewriteBase /
RewriteCond %{HTTP_USER_AGENT} ^.*(Googlebot|Googlebot|Mediapartners|Adsbot|Feedfetcher)-?(Google|Image)? [NC]
RewriteRule .* /var/www/503.html
This website is in maintenance mode, and I don't want anything indexed yet. I tested the code with a firefox Use...
Client wants login pages to load via https. This is easily accomplished, but since the site uses pretty url's, we now stay in https mode when clicking around after login is finished. This breaks secure files which are uploaded in the CMS, stored above webroot, and downloaded by streaming through a php script if user has the appropriate...
Using ManagedFusion's URL rewriter, I have the following code. When requesting / on the Visual Studio development server, I get a redirect loop, however the same code works on a production IIS server when I upload the site to it... why is this? I have <defaultDocument enabled="false"/> in the web.config.
RewriteRule ^/(Default|index|hom...
I am trying to set Apache environment variables (for use in PHP) with the [E=VAR:VAL] flag on RewriteRule rules in an .htaccess file.
I have already discovered the variables are accessed in PHP as server variables $_SERVER rather than $_ENV (which makes a certain amount of sense). However, my problem is for some rules the [E=VAR:VAL] fl...
Hey guys,
I currently have a host where my main site is hosted on. I have set up nginx on another server to mirror/cache files being requested if it doesn't have it already, in particular images and flv videos.
For example:
www.domain.com is my main site.
www.domain.com/video/video.flv
www.domain.com/images/1.png
I would like to as...
Hiya,
I've moved a site to Drupal, but am now getting a lot of 404 errors due to the search engines taking their time to update the indexes.
The 404 paths all look similar to this:
recipedata/ccp1300006/633_L.jpg
recipedata/ccp1500005/risotto.jpg
recipedata/ccp1500006/haddock.jpg
So I'd like to do some htaccess redirection with mo...
I need a url like
mydomain.com/myname/?action=post&data=10
here in a single php page(user.php) i need all 'myname','post' and '10' as get method variables.
How can i get it using .htaccess???...
plz help me.....
...
Hello,
I'd like to rewrite:
www.example.com/file.html?username=john&number=1234
To:
www.example.com/users/john
But I can't figure out how to extract the "username" value from the query string. I've been Googling this all morning and reading the official docs but no luck. I need to solve this problem with a rewrite, rather than chang...
I realise that a backslash should never appear in a URL in a form other than a URL escape code, however in this case the URL's are being generated by a .NET application for generating flashbooks. I have contacted the developer of this application with a bug report.
In the interim i would like to use .htaccess to rewrite the offending b...
I worked on a website for which I had a "development URL" that looked something like this:
www.example.com.php5-9.dfw1-2.example.com/
Now, several weeks after the website launch, there is at least one page of content indexed on Google with that URL.
Question: How do I redirect all requests from that test URL to reroute to the actual ...
Hey there,
I'm trying to change all http://www.mysite.com/filename.php files to show as http://www.mysite.com/filename/ using mod_rewrite, but I seem to be doing something wrong.
Can anyone help out? I'm guessing it's something pretty simple for those that know. Thanks.
...