I have Windows Server 2003, IIS6 with IIRF installed on it. And I have iirf.ini file as follows:
RewriteEngine ON
RewriteLog c:\inetpub\iirfLogs\iirf
RewriteLogLevel 1
StatusInquiry ON
CondSubstringBackrefFlag *
RewriteRule ^/(.*)$ /index.php?p=$1 [U,L]
And it works fine for all the requests except those that ends with .asp (example mysite.com/123.asp). That's why all the requests for .asp files gives me 404 error.
How to fix this bug?
Related
I have .htaccess file with this below code that time website showing with one error message 500 internal server error.
RewriteEngine on
RewriteCond %{HTTP_HOST} ^website\.com [NC]
RewriteRule (.*) http://www.website.com/$1 [L,R=301]
When I renamed to .htaccess file that time it not showing any error it is working fine. I am using 1and1 server windows control panel.
I given file permissions to folders '0755' and for files '0644' and for .htaccess file '604'.
where I did mistake. please suggest me.
I am trying to do a url rewrite with .htaccess that is not working. I have xampp installed on a Ubuntu Linux machine. Here is my .htaccess file:
Options +FollowSymLinks
#From: host/1/products/productname/30/
#To: host/1/index.php?product=productname&price=30
RewriteEngine On
RewriteRule ^1/products/([a-zA-Z]+)/([0-9]+)/$ 1/index.php?product=$1&price=$2
The comment lines in the code show what I am trying to do. I know that .htaccess is being read because if I uncomment the "From" line above, it throws a 500 server error. Otherwise, I get a 404 Object not found error. I have set AllowOverride All in httpd.conf and restarted apache. The error_log is not reporting an error.
Any ideas?
This is my .htaccess as of Dec 2 at 2:05 PM
Options +FollowSymLinks
#From: host/1/products/productname/30/
#To: host/1/index.php?product=productname&price=30
RewriteEngine On
RewriteRule ^1/products/([a-zA-Z]+)/([0-9]+)/$ 1/index.php?product=$1&price=$2
RewriteRule ^foo$ /bar`
Use this rule in your DOCUMENT_ROOT/.htaccess file:
RewriteEngine On
RewriteRule ^1/products/([^/]+)/([^/]+)/?$ /1/index.php?product=$1&price=$2 [L,QSA,NC]
For css/js/images: Use absolute path in your css, js, images files rather than a relative one. Which means you have to make sure path of these files start either with http:// or a slash /.
Alternatively You can try adding this in your page's header:
<base href="/" />
to resolve all the relative resource links.
I have a very simple rewrite rule. My entire .htaccess file is as follows:
RewriteEngine On
ReWriteRule ^([a-zA-Z0-9\-]+)$ /index.php?page=$1 [L,NC]
This works perfectly on one of my development machines running Apache. It does not work however on my other development machine running Apache (mod_rewrite listed in PHP info under apache2handler). Nor does it work on the live server, which I think is running Windows.
I have tried adding the following:
RewriteBase /
I'm no mod_rewrite wizard and I'm sure it's a very simple solution but it is eluding me currently and keep receiving a 404 not found error.
One thing that is different on the two environments in which this doesn't work, is that the site is not in the root of the URL. So for example it is http://localhost/site and www.example.com/site
I have tried various syntax adjustments in the .htaccess file, and also adding the site to the base:
RewriteBase /site
Remove the 'RewriteBase /site' and try removing the / before index.php
The slash should't be there with use of .htaccess
RewriteEngine On
ReWriteRule ^([a-zA-Z0-9\-]+)$ index.php?page=$1 [L,NC]
I have this code in my .htaccess file:
Options +FollowSymLinks -MultiViews -Indexes
RewriteEngine On
RewriteRule ^(design|JS|css|images|remoteLibraries|remoteLibraries/xAJAX/xajax_js/)($|/) - [L]
RewriteRule ^([a-zA-Z_]+)$ index.php?action=$1
RewriteRule ^([a-zA-Z_]+)/([a-z_A-Z]+)$ index.php?action=$1&tip=$2
It works fine on my local Apache server, but when uploading it to GoDaddy all I get is 404 Not found error ...
Any idea?
1) I recommend that you set a RewriteBase, usually just
RewriteBase /
which helps standardize where the rewrite takes effect, since the directory structure may be different between the local and remote servers.
2) I also recommend that whenever unexpected rewrite behavior crops up it is important to set
ErrorDocument 404 default
so that the Go Daddy 404 page is not redirected as well.
I have rewritten a rule for URL rewriting but when i try to access the website admin panel, server shows me 404 error whereas front-end working with rewriting rule.
following rule are written
Options +FollowSymlinks
RewriteEngine on
RewriteBase /
for admin panel
RewriteRule ^admin/page/([a-zA-Z0-9_-]+)\.html$ admin/page.php?page=$1
RewriteRule ^admin/page/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/(.*)$ admin/page.php?page=$1&$2=$3
For frontend
RewriteRule ^(.*)\.html$ $1.php [nc]
Though for front-end rule working fine and i can access the website using www.blabla.com/index.html. Written rule automatically convert the .php file into .html
Moreover these rule are working fine in my localhost and UAT server but on production server these rules do not work.
Any one can suggest what wrong i am doing or is there something with .htaccess or mod_rewrite where i can do some tweaks.
Suggest please.....