jonpugh114 — 2010-10-14T16:34:36-04:00 — #1
I'm trying to set up URL rewriting (which I've done many times before) using Apache mod_rewrite and it looks like .htaccess isn't supported on this set up.
I've seen somewhere that you can set up rewriting using purely PHP, but I'm struggling to find any information on it. Can anyone point me in the right direction?
dave_mclovin — 2010-10-16T15:28:56-04:00 — #2
scallioxtx — 2010-10-16T15:42:13-04:00 — #3
That also relies on a .htaccess file.
As far as I know there is no way to create friendly URLs without using any form of .htaccess
I think you'd better contact the hoster to ask if .htaccess files are indeed disabled, and if they are, if they could enable them.
Are you server is Apache btw? If it's IIS you could use a httpd.conf with ISAPI Rewrite. Provided they have installed that of course.
thruska — 2010-10-15T04:28:12-04:00 — #4
johnyboy — 2010-10-16T18:01:15-04:00 — #5
that's true. and i suppose if the 404 page has an html extension you'd need to either change the 404 page to be used to a php one, or make it so that html extensioned files are parsed by the php parser, either way, .htaccess required. maybe the OP could request the hosting company to change the not found page to a file path of his choice. if so then it'd be possible.
johnyboy — 2010-10-16T17:58:15-04:00 — #6
no, you only send out 404 headers if the page really isn't found. if it's an address to be considered valid, you just don't send out 404 headers from the page not found script.
rguy84 — 2010-10-16T17:42:51-04:00 — #7
Jon, how much access to the machine do you have? If you want to have your own not found page etc, you can make custom ones.
erangalp — 2010-10-16T17:33:53-04:00 — #8
That technique is very bad for SEO since the server sends out 404 headers. Search engines assume the page does not exist
scallioxtx — 2010-10-16T17:27:08-04:00 — #9
That assumes a PHP file can be used as the not found page. That is not necessarily the case, and if it isn't it won't work ...
johnyboy — 2010-10-16T17:19:52-04:00 — #10
all requests which aren't found go to a page not found page. put router-like code in that page's script. so basically in the not found page, using php, get the url and include() the right file. bingo. no .htaccess file access required what so ever.
jonpugh114 — 2010-10-14T16:58:47-04:00 — #11
Yes, I've been using the exact same script for rewriting URL's on brochure sites for well over a year, it's rather well tested...
force — 2010-10-14T16:56:04-04:00 — #12
Have you tried using this line in your .htaccess file before your rewrite statements?
jonpugh114 — 2010-10-16T15:59:50-04:00 — #13
I've found out that it's a Windows machine without Apache, so it looks like there will be no rewriting
scallioxtx — 2010-10-16T16:08:22-04:00 — #14
As I said above, if it's an IIS server you may still be able to rewrite if they have ISAPI Rewrite installed as a module for IIS
If they don't, then there would indeed be no way to do rewrites ...
system — 2010-10-15T04:33:13-04:00 — #15
same scripting url can be classified.