deansaddigh Posted August 31, 2010 Share Posted August 31, 2010 Basically i have written this Options +FollowSymlinks RewriteEngine on RewriteRule ^(.*)\.htm$ $1.php [nc] All i want to do at this stage is mask php extensions of my pagesto htm. But it doesnt seem to be working. Im a complete newb and have been trying to figure out how to use this. Can anyone point me inthe right direction please Link to comment https://forums.phpfreaks.com/topic/212191-just-want-to-mask-php-file-names/ Share on other sites More sharing options...
wildteen88 Posted August 31, 2010 Share Posted August 31, 2010 If you go to site.com/filename.htm it should call site.com/filename.php Do not assume mod_rewrite will change your links for you. You'll need to change your links from <a href="path/to/filename.php">some link</a> to <a href="path/to/filename.htm">some link</a> yourself. mod_rewrite will only map the url site.com/filename.htm to site.com/filename.php Link to comment https://forums.phpfreaks.com/topic/212191-just-want-to-mask-php-file-names/#findComment-1105759 Share on other sites More sharing options...
deansaddigh Posted September 1, 2010 Author Share Posted September 1, 2010 Sorry for my ignorance, are you saying i need to manually go through and change every php file to and htm file extension? Link to comment https://forums.phpfreaks.com/topic/212191-just-want-to-mask-php-file-names/#findComment-1105991 Share on other sites More sharing options...
wildteen88 Posted September 1, 2010 Share Posted September 1, 2010 No, You don't rename the files. You need to alter the links within your php files. Link to comment https://forums.phpfreaks.com/topic/212191-just-want-to-mask-php-file-names/#findComment-1105995 Share on other sites More sharing options...
deansaddigh Posted September 1, 2010 Author Share Posted September 1, 2010 Ahhh i see, what happens if someone manually goes to a php page, Like could they just still go to for exanple If they can i struggle to see the point http://www.languageschoolsuk.com/uk_videos.php Link to comment https://forums.phpfreaks.com/topic/212191-just-want-to-mask-php-file-names/#findComment-1105996 Share on other sites More sharing options...
wildteen88 Posted September 1, 2010 Share Posted September 1, 2010 If they can i struggle to see the point All you're telling mod_rewrite to do here RewriteRule ^(.*)\.htm$ $1.php [nc] Is to map any url ending in .htm to the corresponding .php file. You havn't told it to prevent the user from accessing the .php file. Link to comment https://forums.phpfreaks.com/topic/212191-just-want-to-mask-php-file-names/#findComment-1106012 Share on other sites More sharing options...
deansaddigh Posted September 1, 2010 Author Share Posted September 1, 2010 Thanks alot for your help, i understand what you have said, thanks again Link to comment https://forums.phpfreaks.com/topic/212191-just-want-to-mask-php-file-names/#findComment-1106013 Share on other sites More sharing options...
deansaddigh Posted September 1, 2010 Author Share Posted September 1, 2010 Ok so i have changed my links to.htm and written the rewrite rule htaccess file RewriteEngine on RewriteRule ^(.*)\.htm$ $1.php [nc] heres my error. Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. Can anyone see why? is this a hosting issue? Kind regards Dean Link to comment https://forums.phpfreaks.com/topic/212191-just-want-to-mask-php-file-names/#findComment-1106019 Share on other sites More sharing options...
deansaddigh Posted September 1, 2010 Author Share Posted September 1, 2010 Forget that, i figgured it out, silly me had. RewriteEngine on with the "on" on a seperate line, Derrrr Thanks guys Link to comment https://forums.phpfreaks.com/topic/212191-just-want-to-mask-php-file-names/#findComment-1106020 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.