Well, I've been using iframes before, I'm trying to use new techniques. PHP is so much more sophisticated and seems to load faster.
Generally speaking, static websites don't require PHP. (Pre-Hypertext-Procesor). Logics made simple, compare Pre-Hypertext-Processor to HyperText Markup Language and you'll understand the point of PHP in HTML just reading that "Pre". Because it works with data before page is shown, then it renders the final HTML.
There is one easy solution for your making page SEO friendly. You can show your php page as html or htm to User/Browser. For that, It require to edit .htaccess file in your server. Put below code in .htaccess file RewriteEngine on RewriteRule ^(.*)\.html$ $1.php [nc] For making this work, you need to enable the mod_rewrite extension. You also have to change the links in Web page. For example, You can call index.php in browser using index.html. Let me know if this helps you or have any queries. Thanks,
Now basically I will have HTML-written pages, but saved as .php, because they will contain 2-3 php scripts in them, each. I think this is all right now. I don't want to rewrite the .php extension to .htm What I want is to eliminate the .php from the end... not sure how I can do this, I tried several codes, but they didn't show any results. I don't want redirection, but extension (.php) eliminated. Of course, I would also like to eliminate the "index.php" pages, so that they don't show up. They should appear: http://www.mysite.com http://www.mysite.com/topicone instead of: http://www.mysite.com/index.php http://www.mysite.com/topicone/index.php
Rewrite is good solution if you can implement that. Because users never come to know that this page is actually PHP. You can also eliminate the index.php using rewriting.
@Chirag, you didn't even bother answering OP's question, as I'm reporting your post for post hunting / offtopic. @Mr. Dog, try this in your .htaccess The line with !-d checks that it's not a directory, the line with -f checks that the requested file is a .php file.
Actually you're wrong, you make the bot's life easier. It doesn't need to loop that string and strip the title anymore.
It looks good and that's why I want to change it. Also: when sharing an URL, people like it more if it's without an extension. I have .php and .htm files, other sites use .html... sometimes people mistype... edduvs: will try that code later today, what I've tried by myself didn't work at all... not sure if there's some server setting blocking it or what...
Just so you know, the extension does not matter for the default/index file that displays when visiting a directory..... So if you visit www.domain.com/pvpvshtml/ then your default file will display regardless of file extension. Your insights are uneducated, imo; perhaps you need to do more research before implementing what you think is the best way. Anyways... nobody should be typing the full path to a specific file anyways. People use hyperlinks, shortcuts and bookmarks to navigate websites.
I tried using this for .htm extensions, but it's not working... I created a fresh new (blank) .htaccess file in notepad, put this in and uploaded it: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.htm -f RewriteRule ^(.*)$ $1.htm Code (markup): Still not working. The .htaccess file is on the root folder, where my site's index.htm file is located... perhaps the location is not right?
This might be a stupid question, but are you sure your hosted on Apache? .htaccess doesn't work on other types of server software. If it's nginx or IIS -- it's not gonna work.
...it's an Apache server and they're saying it has to be rewritten. I've used similar codes a few days ago and those didn't work either. I have the upper code in the .htaccess page, which is in the root public_html folder. The .htaccess only contains this code, nothing else. I created it from a blank Notepad page. Can't see the reason why it's not working, but I have no experience in how to write these .htaccess codes.
Well, right now I used this code for removing the .htm extension, this time I tried ".htm" and also with ".html" in the code, but didn't work: RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.html -f RewriteRule ^(([^/]+/)*[^./]+)/$ $1.html RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]|/)$ RewriteRule (.*)$ /$1/ [R=301,L] Code (markup): .htaccess is right on the root where my index.htm file is... I also tried with this code: RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.htm -f RewriteRule ^(([^/]+/)*[^./]+)/$ $1.htm RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]|/)$ RewriteRule (.*)$ /$1/ [R=301,L] This code isn't working either... I cleared my cache, tried different browsers. It's not propagating.
You're getting too complex -- though I would question if htaccess is even enabled. Is your hosting running cPanel? Misconfigured that can raise all sorts of hell... Idea... try JUST THIS in a .htaccess, it's the one I use for my pages: RewriteEngine On RewriteRule !\.(gif|jpg|png|css|js|html|ico|zip|rar|pdf|xml|mp4|mpg|flv|swf|mkv|ogg|avi|woff|svg|eot|ttf|jar)$ index.php Code (markup): The above rule is a whitelist -- files of the above extensions are served normally -- those NOT using the above extensions are routed to test.php With this as index.php: <?php echo $_SERVER['REQUEST_URI']; ?> Code (markup): That should output the URL you tried to access. That's how I handle 'user friendly' URL's -- I just shove the entire request at PHP without trying to play fancy games parsing out the GETDATA in the .htaccess; If that doesn't work, then your server isn't configured properly or you're doing something REALLY wrong. In production I just extract the getdata from the original request as provided in $_SERVER. You can even use $_SERVER['PHP_SELF'] to help parse it out. function cleanPath($path) { return str_replace(array('\\','%5C'),'/',$path); } $url=cleanPath($_SERVER['REQUEST_URI'], 1); if (strpos($url,'../')) die('Uptree link in URI'); $offset = strlen($_SERVER['PHP_SELF']) - 9; $end = ($end == strpos($url,'?')) ? $end - $offset : 4096; $url = substr($url,$offset,$end); $request = empty($url) ? array('default') : explode('/',$url); Code (markup): The cleanpath function is there to prevent Windows vs. IE slashes. The minus 9 on PHP_SELF's length is the length of 'index.php' -- which doing this should always give you the root URI.