In order to redirect all somefolder/index.html (and also somefolder/index.htm) to somefolder/ I use this simple rewrite rule in Apache .htaccess file:
RewriteEngine on
RewriteCond %{THE_REQUEST} ^.*\/index\.html?\ HTTP/
RewriteRule ^(.*)index\.html?$ "/$1" [R=301,L]
This works well!
But at Google groups they suggest to add also:
Opt...
I'm attempting to perform some url rewriting, and after looking at the phpinfo file, I can't see any mention of this.. My host is FastHosts.
Should I be looking for something else in the phpinfo() or should I assume that mod_rewrite is simply disabled?
...
Using Apache on a Red Hat server, I'm trying to rewrite the URL of a member's store on our website from:
domain.com/store.php?url=12345
to:
domain.com/12345
Using these rules, I can get it to work if I always remember to add an ending slash:
Options -Indexes
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^store/url/(.*)$ st...
Ok folks, I'm at a loss.
RewriteCond %{HTTP_HOST} ^domain.nl$
RewriteRule ^(.*)$ poker/$1 [L]
Throws me a 500 error. If I remove the redirect and go to /poker/ manually it works. If I use this:
RewriteCond %{HTTP_HOST} ^domain.nl$
RewriteRule ^$ poker/ [L]
The front page is shown (but the css not, because obviously anything after t...
I have url's like games/xbox/2
2 being the page number I need the url rewritten. This is what I'm using:
RewriteRule games/(.*?)/$ games/consoles.php?console=$1
RewriteRule games/(.+?)/(.+?)/$ games/consoles.php?console=$1&page=$2
The first rule works fine but the second is returning consoles.php as $1 instead of xbox
...
Hi all, I am very new to mod rewrite so any help would be apprecited.
let say i have a site named "www.sitename.com/index.php?p=contact"
and i need to remove "index.php?p="
so that it will look like "www.sitename/contact"
at its every occurence that means either i should be able to truncate "index.php?p=" or i should be able to replac...
RewriteRule ^/tag/term$ /tag/term-expanded-here [R]
...
I've imported my mod_rewrite rules... everything works just fine... but seemingly randomly it deletes them all.
I've been moving some files around in wwwroot... so, my question is this:
When I import rewrite rules, does it create a new file somewhere in wwwroot that I happen to be moving/deleting every time?
Thanks for any help you ca...
Hi StackOverflow !
is there a way to tell Apache to simulate a directory in the URL ?
Here is what I'm trying to do... I currently have an URL like http://photo.mydomain.com/pics/17/120417/1.jpg and I would like to be able to reach the same content with an URL like http ://photo.mydomain.com/pics/51/17/120417/1.jpg .
Is that possible ...
I am developing a website, and I have set up the following htaccess rules
RewriteEngine On
#RewriteRule ^([0-9]+)?$ index.php?page=$1
#RewriteRule ^([0-9]+)/([0-9]+)?$ index.php?page=$1&post=$2
RewriteRule ^([A-Za-z0-9-]+)?$ index.php?pagename=$1
RewriteRule ^([A-Za-z0-9-]+)/([A-Za-z0-9-]+)?$ index.php?pagename=$1&post=$2
This ensures...
I am updating a php app, which currently does not use url rewriting. The aim is to hide file extensions. The general structure of the website is as follows
root/
index.php
login.php
page1.php
page2.php
page3.php
page4.php
page5.php
page6.php
page7.php
page8.php
subfolder/
index.php
validpage.php
images/
css/
Th...
Hi,
I am using .htaccess RewriteRule on a website I'm working on.
Here is a sample of my .htaccess
RewriteEngine on
RewriteRule ^about.htm$ /index.php?load=about&output=html [NC]
I would like to know if there is a way in my index.php file to detect
if the page have been called via a Rewrite or the user reached it
directly. I'm tryin...
I want to configure a mod_rewrite rule without using .htaccess files. When I put rules in .htaccess files they work fine, but I would prefer to leave all of the configuration in my /etc/apache2/sites-available/[site name] config file.
When I place the same RewriteRules within the VirtualHost or Directory directives, nothing works. What...
Hi,
I have the following URL:
http://testhost.com/offers/311/133/[email protected]/
and I'm wanting to redirect it to this url:
http://testhost.com/offers/311/133/test_at_test.com/
Can someone provide me with the Rewrite Conditions and Rule to do this?
Thanks in advance!
...
Hi! I'm playing with .htaccess and I was wondering if with just an .htaccess inside the root directory is possible to block all the request from a browser directed on existing files or directories.
Let's try this example:
RewriteEngine On
RewriteBase /~my_user/my_base/
RewriteRule ^list/$ list.php [L]
RewriteRule ^element_of_list/([a...
We have a PHP app with a dynamic URL scheme which requires characters to be percent-encoded, even "unreserved characters" like parentheses or aphostrophes which aren't actually required to be encoded. URLs which the app deems to be encoded the "wrong" way are canonicalized and then redirected to the "right" encoding.
But Google and othe...
Hey,
In my scenario I redirect
"/index/../" to "/index.php?act=..".
I was wondering how can I restrict direct access to "/index.php" but still be able to redirect from "/index/../"?
P.S. "/../" is anything... it seems you can't use * there. O.o
Thanks in advance,
The Devil
...
I just installed a fresh copy of Drupal 6.19 to get to speed on how to write modules. But for some reason the rewrite module isn't working for Drupal.
What I have checked:
$ apachectl -M >> it is installed
php_info() on current server >> says rewrite is installed also
I also double-checked the .htaccess file in my Drupal root folde...
Good morning.
I currently have this little rule in my .htaccess
RewriteEngine On
RewriteBase /
RewriteRule ^brochure/([0-9]+)$ /brochure.php?cat_path=$1 [L]
(i'm just using numbers for example here, will be category names later.)
This redirects perfectly, but when it does, everything I have in directories now fail (css, js, images, ...
I want get everything up to the "/" and merge with ".php"
works fine, but when the file does not exist I get internal error
RewriteRule ([^\/]*) $1.php
...