index.php shown up in every link - wordpress

my problem is that my link shows (index.php) in every link like this
(www.mysite.com/index.php/postname)
and i want to show it like this
(www.mysite.com/postname)
but i want to remove that (index.php) from my links so how to do that?
i m using
(iis) 7.5 and (wordpress) 4.01
i try so many things but did not work so how to solve it?
and i cant also see web.config
but i can see (wp.config) so are they same?

You need to log into wordpress admin and go to permalinks and change
Custom Structure to: /%postname%/
Do not add the domain or index.php
if your'e running IIS you need to follow instructions on this link:
http://codex.wordpress.org/Using_Permalinks#Permalinks_without_mod_rewrite
or you can just
add web.config file to the root folder (where the WP install is) containing
<?xml version="1.0"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Main Rule" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Then you can adjust your permalinks to your custom setup in the admin panel.

Related

Angular 2 Visual Studio Setup Problems

I followed the Angular2 VS setup from this page-
https://angular.io/docs/ts/latest/cookbook/visual-studio-2015.html
The issue is that http://localhost:56428/ gives a 403 (forbidden) error, and the only way to access my index is to navigate to http://localhost:56428/src/index.html.
This is not ideal, and doesn't even work because requests to system.js and other files on this page go straight to the web root.
I'm not sure if I missed a step here but I don't think this is what they intended. How do I make src/ servable at /?
ANSWER FOUND AT
.net web application change root directory
I don't know why the angular site does not mention that.
Try to add base tag:
The tag specifies the base URL/target for all relative URLs in
a document
.
http://www.w3schools.com/tags/tag_base.asp
ANSWER FROM
.net web application change root directory
<configuration>
<system.web>
...
<urlMappings enabled="true">
<add url="~/" mappedUrl="~/src/index.html" />
</urlMappings>
</system.web>
...
<system.webServer>
...
<rewrite>
<rules>
<rule name="Redirect everything to root" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="/src/{R:0}" />
</rule>
</rules>
</rewrite>
</system.webServer>
...
</configuration>
Have you marked your index.html as application start up page?
If not, right click on index.html and click on "Set As Start Page".

Installing ZF2 IIS7

I have been trying to install ZF2 on IIS7, the issue I am having is that I need to add
'view_manager' => array(
'base_path' => '/accounting/public/'
),
in the global in order for the headers css, js to work, this updates the
->prependStylesheet($this->basePath() . '/css/jquery-ui.css')
and I get the full path "/accounting/public/css/jquery-ui.css"
but the real problem comes on the input images I have on the views like this one:
<input type='image' name='pay' value=1> src='/img/payment-32.png' title='Pay'>
one solution can be
<input type='image' name='pay' value=1> src= $this->basePath().'/img/payment-32.png' title='Pay'>
If I open the firebug and go to the head tag and position myself over the a link with the cursors i can see "http://localhost/js/jquery.js" but even tough is there is as if the root path it still pointing to /public/.
In Apache I dont have that, cud just easily have "/img/payment-32.png" and it will find the image, but for some reason I cant on II7. I know that maybe is a configuration issue.
Any ideas?
.htacess files do not work with iis you'll have to install a mod rewrite module for iis and configure it to your needs.
There is a blog post covering these steps. Might be worth checking it outhttp://lab.empirio.no/zf2-urlrewriting-in-iis7.html
As the blogpost suggest create a web.config file within the public folder and add a config similar to this:
Source: http://lab.empirio.no/zf2-urlrewriting-in-iis7.html
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Empirio (www.empirio.no)" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

Wordpress Permalinks on IIS 7 with WCF services using service factory

Suppose you're hosting Wordpress on IIS 7 and you want to activate permalinks. Looking at the codex here, you'll see this example code for the web.config file (located at the root of your WordPress install) to be added in the <system.webServer> tag:
<rewrite>
<rules>
<rule name="Main Rule" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
All is well and the url rewrite rule's conditions correctly ignore existing files and folders present on the system.
However, you may come to a situtation, as I did, where you need to ignore every uri that lies within a certain sub folder, even if there is not a corresponding file on the filesystem. In my case I am hosting a set of WCF services in a subdirectory /Services/ using the <serviceActivations> area of the web.config (at the subdirectory) in the form:
<serviceHostingEnvironment multipleSiteBindingsEnabled="true">
<serviceActivations>
<add factory="System.ServiceModel.Activation.ServiceHostFactory" relativeAddress="./AccountService.svc" service="MyAssembly.Services.AccountService"/>
</serviceActivations>
</serviceHostingEnvironment>
Navigating to the AccountService.svc will cause a 404 not found.
How can you handle this situation? Below I have posted my specific solution, but there are other ways to achieve this. Also, a general case solution is still elusive, so the question remains, how can you handle this situation generally?
Below I've provided my solution as a complete newbie to the world of URL Rewrite. The solution is specific to a particular folder.
To solve my problem is was necessary to add an additional condition to the rewrite rules:
<rewrite>
<rules>
<rule name="Main Rule" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_URI}" pattern="^/Services/.*" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
In your case, substituting your folder name where I have "Services" will suffice.
What if you wanted to do this for any directory or directory hierarchy, such that if the directory hierarchy exists, then let any url containing that directory hierarchy pass through without being rewritten. My attempt at this has thus far centered around matching the portion of the url which contains the directory hierarchy and using a back reference to detect if this directory exists:
<rule name="ignoreSubDirectoryURIs" stopProcessing="true">
<match url="(.*)/.*\..*" ignoreCase="false" />
<conditions>
<add input="{APPL_PHYSICAL_PATH}\{R:1}\" matchType="IsDirectory" />
</conditions>
<action type="None" />
</rule>
This rule is added first so that if it is successful the other rewrite rule is not interpreted.
Problems: while {APPL_PHYSICAL_PATH} is a directory, I haven't been able to get any combination of {APPL_PHYSICAL_PATH} and a sub directory to resolve correctly. The other problem is with nested directories, where the {R:1} will return dir1/dir2, instead of dir1\dir2, which may make this not work for the nested case.
Reading the URL Rewrite Reference has been instructive if not complete

Wordpress Pretty Permalinks redirecting to home page on iis7

I have my WP site on iis7[Windows server 2008 R2];have explored a lot to find the right solution but nothing worked :(
http://cricketclips.net/late-overs-batting-flurry-from-luke-wright-pepsi-ipl-2013-kxip-vs-pw-match-29/
Added the following code to web.config in root
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="WordPress Rule" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php?page_id={R:0}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
but still it didn't work
My Url are being rewrite but are redirected to homepage instead of single.php and other pages ( that is index.php instead of single.php)
have checked the server for "FCGI" and "URL rewrite module", both are installed.
Any help in this regard will be appreciated.
This link helped me make my permlinks to work!
Just followed the steps
Changed the permalink structure to
http://example.com/index.php/%post_id%/%postname%/
Checked the result and voila! it was working...
Then changed the link back to
http://example.com/%post_id%/%postname%/
And happily ever after :)
You can Change the permalink setting from here
http://localhost/{your_projects_name}/wp-admin/options-permalink.php

Wordpress permalinks on IIS?

I am using WordPress on Windows 7 IIS to develop. I am uploading images in WordPress for a blog post. The image displays fine on the web site but as soon as I enable permalinks the images no longer work and any future images uploaded I get back an error:
HTTP Error 500.50 - URL Rewrite Module Error.
The page cannot be displayed because an internal server error has occurred.
I am not sure why this would be happening, here is my web.config:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="wordpress" patternSyntax="Wildcard">
<match url="*" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
As soon as I turn off my permalinks and use the default it works, does anyone know why this could be?
The image issue was a permission issue, but simply setting it manually
on the original image file or parent folder is inadequate. The
behavior of WordPress is that it writes the original file using IUSR
to a temporary system directory that is defined in the PHP.ini file.
This temp folder does not have IIS_IUSRS permissions on it, so when
windows moves this file from the temp folder to the application's
upload folder, its final home, IIS_IUSRS only has read permissions, so
the permissions are not inherited from the file's parent folder.
To fix this, there are two solutions.
Change the permissions on the temp folder giving IIS_IUSRS write/modify.
Change the path of the temp folder in the PHP.ini file to a folder that does have IIS_IUSRS write/modify permission.
Here is a good source detailing the problem:
http://www.howyoudo.info/index.php/how-to-fix-windows-server-upload-file-inherit-permissions-error/
I chose to move the temp folder in my PHP.ini to
C:\inetpub\temp\uploads and also give it permissions. After uploading
an image in wp-admin, I was able to access the image (original, not
resized) from a browser wihout the 500.50 error.
From source
There's a slightly different web.config at Using Permalinks « WordPress Codex as well as other options for Permalinks without mod rewrite on Windows.
To help other users this issue is due to permissions in IIS and a fix is also here:
http://forums.iis.net/t/1159252.aspx
use this below mention RULEs in your web.config file ..
<rule name="Imported Rule 1" stopProcessing="true">
<match url="^index\.php$" ignoreCase="false"/>
<action type="None"/>
</rule>
<rule name="Redirect Image to HTTP" stopProcessing="true">
<match url=".*\.(gif|jpg|jpeg|png|css|js)$" ignoreCase="true"/>
<action type="Rewrite" url="{R:0}"/>
</rule>
<rule name="Imported Rule 2" stopProcessing="true">
<match url="." ignoreCase="false"/>
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true"/>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true"/>
</conditions>
<action type="Rewrite" url="/index.php"/>
</rule>

Resources