I'm used to making .htaccess rewriterules for PHP sites. But now I'm trying to do it with IIS7 which is totally new for me.
What I would like is when I insert the url with the page afterwards (www.website.ext/page), that it looks for the page www.website.ext/index.php?page=title.
In .htaccess it would be something like:
RewriteRule ^(.*)$ index.php?page=$1
But how can I do this in IIS7?
Thanks in advance!
I think that is not possible without plugins.
We bought this one few years ago http://www.helicontech.com/isapi_rewrite/ for mod_rewrite
Then you can upload your .htaccess file like on apache server.
Related
I try to making work a php site on my NAS Synolgy DS916Play.
The problem I have is I need to rewrite all api call to index.php with in form:
Initial call: controller/action?queryParams final call:
api/index.php?route=controller/action&queryParams;
I try to put a .htaccess in site folder, but Apache didn't read this file (I put something wrong there, and no error occurred).
SO I need help in two problem:
Configure Apache on NAS, to read .htaccess,
A .htaccess file for what I need.
I have a version, but I'm not sure if it's correct:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^([\w\/\-]+)/?$ api/index.php?_route_=$1 [QSA]
</IfModule>
Or if someone has other solution, I'm glad to hear it.
The site is One page application angularJS with backend php.
First off this is similar to other stack questions however none of the solutions helped me. so before your mark as duplicate, or whine about the question try look for solutions and not problems with the question.
Hi all, here's the scoop, I have tried to be thorough.
I have a site that is in mid development.
A potential employer wants to check out the site in its current state.
In order to do this I had to put it as a sub domain of a site I already have hosted with GoDaddy.
the site uses pretty urls that link to php scripts in various directories.
mysite.com/location
would, via htaccess rules go to a script at
mysite.com/src/script/php/location/location.php
or another example might be
****mysite.com/location/fj83jfd83****
would, via htaccess rules go to a script at
mysite.com/src/script/php/location/location.php?item=fj83jfd83
my htaccess file works on my local WAMP stack but not once on the remote goddady server hosted with linux cpanel
my htaccess file is as follows
RewriteEngine On
RewriteBase /
AddDefaultCharset utf-8
RewriteRule ^location/([A-Za-z0-9]+)/?$ src/script/php/location/location.php?item=$1 [NC,L]
RewriteRule ^location$ src/script/php/location/location.php [NC,L]
Question one
I am wondering what changes do I need to make to the htaccess file for this to work on the GoDaddy server on a subdomain like mysite.hostedsite.com?
Question 2
would the htaccess go in the base public root folder or the subdomain root folder?
Couple things to note.
I am open to options that don't use htaccess or another work around that hasn't occurred to me.
This is only for someone to view the site, so a short term patch(hack) solution is fine, the site is not ready for launch.
thanks you in advance
All I needed to do was add the subdomain to the start of the rewrite rule.
so
RewriteRule ^location$ src/script/php/location/location.php [NC,L]
needed to be
RewriteRule ^mysite/location$ src/script/php/location/location.php [NC,L]
just left it encase it helps any one in the future!
I'm using EasyPHP 14.1 DevServer and I'm currently developping my own website on my computer.
I was introduced to a new method called URL Routing/Rewriting today.
I found this useful website that generates the lines that I need to add to my httpd.conf file.
(I've double checked and the rewrite module is running)
I tried a quick example, a few ones actually, and none of them worked.
I tried to redirect myself from http://localhost/47.html to http://localhost/site1/showproducts.php?id=47 by adding these lines to httpd.conf
RewriteEngine On
RewriteRule ^([^/]*)\.html$ /site1/showproducts.php?id=$1 [L]
I wanted this link http://localhost/site1/products/47/ to lead to http://localhost/site1/showproduct.php?id=47
I'm fairly new to this, so any help would be appreciated
Ok just update that,
RewriteEngine On # Turn on the rewriting engine
RewriteBase /
RewriteRule ^products/([0-9]+)/?$ showproduct.php?id=$1 [NC,L] # Handle product requests
This will work.
I am trying to rewrite a directory to its own sub folder. I have an .htaccess file in the directory, and I also put the AllowOverride All in the Apache conf file.
Basically, I want the server to redirect this url: http://example.com/MPOS to http://example.com/MPOS/public. The closest I got was using this:
RewriteRule /MPOS$ /MPOS/public/ [L]
It does the job, going to http://example.com/MPOS/public, but its the rest of the resources (all the pages, stylesheets and the rest) are not being redirected, and so I get the page as if the links are broken. Inside public folder there is "index.php" file.
I know there are many questions about it, but after hours of search nothing helped me, so I posted this question.
Any help would be really appreciated.
Thanks,
Shay
OK, I feel a bit stupid. Managed to get it to work by writing the rewrite like this:
RewriteRule ^$ /MPOS/public/ [L,R]
When the .htaccess is found in the "MPOS" folder.
My urls are currently like:
/events.html
/contact.html
What I want to do is, redirect them to a php get variable.
E.g events.html = index.php?page=events
Any ideas on how this could be accomplished?
Thanks A lot.
You are looking for mod_rewrite here.
With the rule something along the lines of (assuming mod_rewrite is installed and enabled and you're putting it in a .htaccess file)
RewriteEngine on
RewriteRule ^/(.*).html /index.php?page=$1