5 Replies - 2881 Views - Last Post: 18 April 2013 - 08:56 PM

#1 matt12345  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 35
  • Joined: 08-June 12

URL Requests & web.config

Posted 18 April 2013 - 07:48 PM

I recently put a personal blog I've been making from scratch, using HTML, CSS, PHP, and Javascript online, via Godaddy. I am using Windows hosting (IIS 7.0/ASP.Net 4.0/PHP 5.3), and I'm faced with three issues in regards to URL requests made to my website: www.mattkunin.com. I know that under Windows, the web.config file is used, whereas on Linux, it's the .htaccess file that's used. I have no experience whatsoever when it comes to web.config.

Issues:

1) If I enter a random page into the address bar, such as "mattkunin.com/fdsanfksdnfkjsdnfkdsbfgjrbvjkfbjaskfheiruebfaeiylkrbgio," it auto-redirects to my 404 page, specified by Godaddy (which just so happens to then redirect the user back to the home page). This is good. However, the issue comes when I enter something random, yet with the file extension ".php" at the end. If I enter "mattkunin.com/fdsafiofiosdfio.php," I would hope it would also auto-redirect to my 404 page, since I don't have a file under that name, but this isn't the case. Instead, I get the output "No input file specified." Obviously, I'd like for this to mimic the behavior of what happens when I simply enter random text (w/o the ".php" at the end) after "mattkunin.com/."

2) If I try to open a valid page on my site, but without the file extension, it treats it as if I'm entering "mattkunin.com/randomtext." This means that it'll auto-redirect me to my 404 page, which in turn will send me to my home page. I want the server to behave as if I enter in the URL but with the file extension at the end, yet still show the original requested URL.

Example of what I want:

- I request "mattkunin.com/contact," and it will load my contact.php page, but keep the URL in the address bar the same (w/o the extension).

3) How can I make it so that all URL requests made will end up starting with "http://www?" This way, no matter what's entered into the address bar, the end result will always be "http://www."

My web.config file:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.web>



  </system.web>
</configuration>



Thanks!

This post has been edited by matt12345: 18 April 2013 - 07:55 PM


Is This A Good Question/Topic? 0
  • +

Replies To: URL Requests & web.config

#2 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 8377
  • View blog
  • Posts: 31,138
  • Joined: 12-June 08

Re: URL Requests & web.config

Posted 18 April 2013 - 07:58 PM

It doesn't sound like you are using the windows hosting for asp.net pages, right? Seems like an odd choice for hosting if you are not going that route, but okay.

Examples of how htaccess would have solved your problems:

1 -> read up on htaccess basics
http://www.htaccessb...tom-error-page/

2 -> adding file extensions.
http://support.godad...file-extensions

---------
As for the webconfig typically you would set all that up in the IIS. Do you have access to that?
Was This Post Helpful? 0
  • +
  • -

#3 matt12345  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 35
  • Joined: 08-June 12

Re: URL Requests & web.config

Posted 18 April 2013 - 08:34 PM

View Postmodi123_1, on 18 April 2013 - 08:58 PM, said:

It doesn't sound like you are using the windows hosting for asp.net pages, right? Seems like an odd choice for hosting if you are not going that route, but okay.

Examples of how htaccess would have solved your problems:

1 -> read up on htaccess basics
http://www.htaccessb...tom-error-page/

2 -> adding file extensions.
http://support.godad...file-extensions

---------
As for the webconfig typically you would set all that up in the IIS. Do you have access to that?


I started out on Linux hosting, but quickly found that AJAX wasn't working, though Javascript generally was. I did some research, and from where I looked, I came to the conclusion that Linux hosting wasn't going to work for me anytime soon, as my site does use quite a bit of AJAX (for me, when logged into my blog). Linux, alongside my .htaccess file, actually worked fine up until the OS switch, and all went well till then in regards to URL requests.

Now, however, I get AJAX support but at the cost of URL bugs (like I said in the previous sentence). If there's a way to get Linux hosting to support AJAX though, that'd be great, as I'm sure a free switch back to Linux with some .htaccess editing (and/or whatever else would be required) would be a lot smoother than trying to get this web.config file all written out from scratch. Addressing your provided links, if I'm to stay on Windows, shouldn't I be researching the web.config file, rather than the .htaccess file?

Yes, I have access to IIS. In Godaddy, it can be found by:

My Account > Web Hosting > Launch > Hosting Details > Tools > IIS Management

Within IIS, there's one directory listed (Content Root), and it's check marked by default, with a status that reads "Setup."

This post has been edited by matt12345: 18 April 2013 - 08:36 PM

Was This Post Helpful? 0
  • +
  • -

#4 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 8377
  • View blog
  • Posts: 31,138
  • Joined: 12-June 08

Re: URL Requests & web.config

Posted 18 April 2013 - 08:40 PM

Hmm.. okay.. So ajax isn't something that would be affected by being on linux. It's a variation of javascript.

If you can run javascript on your site then you can run ajax. It's as simple as that.
Was This Post Helpful? 0
  • +
  • -

#5 matt12345  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 35
  • Joined: 08-June 12

Re: URL Requests & web.config

Posted 18 April 2013 - 08:48 PM

View Postmodi123_1, on 18 April 2013 - 09:40 PM, said:

Hmm.. okay.. So ajax isn't something that would be affected by being on linux. It's a variation of javascript.

If you can run javascript on your site then you can run ajax. It's as simple as that.


I know it's a variation of Javascript. However, I'm only telling you exactly what I experienced while using Linux. All my non-AJAX Javascript code worked fine, but when it came to actually running AJAX code, that variant of Javascript wouldn't work at all.

Now that I'm using Windows, not only does all my non-AJAX Javascript code run smoothly, but so does my AJAX code.

This post has been edited by matt12345: 18 April 2013 - 08:50 PM

Was This Post Helpful? 0
  • +
  • -

#6 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 8377
  • View blog
  • Posts: 31,138
  • Joined: 12-June 08

Re: URL Requests & web.config

Posted 18 April 2013 - 08:56 PM

*shrug* If you say so.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1