Jump to content
Larry Ullman's Book Forums

Search the Community

Showing results for tags '.htaccess'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Single Editions
    • Modern Javascript: Develop and Design
    • The Yii Book
    • Effortless Flex 4 Development
    • Building a Web Site with Ajax: Visual QuickProject
    • Ruby: Visual QuickStart Guide
    • C++ Programming: Visual QuickStart Guide
    • C Programming: Visual QuickStart Guide
    • Adobe AIR: Visual QuickPro Guide
  • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (5th Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (4th Edition)
    • PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide (3rd Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (2nd Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (1st Edition)
  • PHP for the Web: Visual QuickStart Guide
    • PHP for the Web: Visual QuickStart Guide (5th Edition)
    • PHP for the Web: Visual QuickStart Guide (4th Edition)
    • PHP for the Web: Visual QuickStart Guide (3rd Edition)
    • PHP for the World Wide Web: Visual QuickStart Guide (2nd Edition)
    • PHP for the World Wide Web: Visual QuickStart Guide (1st Edition)
  • Effortless E-commerce with PHP and MySQL
    • Effortless E-Commerce with PHP and MySQL (2nd Edition)
    • Effortless E-Commerce with PHP and MySQL
  • PHP Advanced: Visual QuickPro Guide
    • PHP Advanced and Object-Oriented Programming: Visual QuickPro Guide (3rd Edition)
    • PHP 5 Advanced: Visual QuickPro Guide (2nd Edition)
    • PHP Advanced: Visual QuickPro Guide
  • MySQL: Visual QuickStart Guide
    • MySQL: Visual QuickStart Guide (2nd Edition)
    • MySQL: Visual QuickStart Guide (1st Edition)
  • Other
    • Announcements
    • Newsletter, Blog, and Other Topics
    • Forum Issues
    • Social

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Found 6 results

  1. I am modularizing a existing site as discussed in Chapter 2. All is working fine but I cannot seem to find the correct rewrite script for my .htaccess relative to rewriting (or forwarding existing) links that have been indexed in search engines. An example: http://www.example/productdetail.php?id=100 (as indexed by Google) should display as http://www.example/product-detail/100/ but instead is displaying in address bar as http://www.example/product-detail/?id=100 (and obviously no page is found) My current .htaccess is: RewriteEngine On RewriteRule ^([^/]*)/$ /index.php?p=$1[L] RewriteRule (product-detail)/([^/]*)/$ /index.php?p=$1$id=$2 I also have a URL redirect for this page: Redirect 301 /productdetail.php http:www.example.com/product-detail/ Any assistance would be appreciated.
  2. I have been working on the project in Chapter 2. So far everything is running well. I am currently trying to get the mod_rewrite capability in .htaccess working. But seem to be having problems. Let me explain my setup: My root_document folder is as follows: C:\Program Files (x86)\Zend\Apache2\htdocs\PHPadvanced\project_1 The changes that i have made to the httpd.conf is as follows: <Directory "C:/Program Files (x86)/Zend/Apache2/htdocs/PHPadvanced/project_1"> AllowOverride All </Directory> I have placed this at the bottom of my httpd.conf file. I have not changed the settings that are earlier in this file: <Directory "C:\Program Files (x86)\Zend\Apache2/htdocs"> # # Possible values for the Options directive are "None", "All", # or any combination of: # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews # # Note that "MultiViews" must be named *explicitly* --- "Options All" # doesn't give it to you. # # The Options directive is both complicated and important. Please see # http://httpd.apache.org/docs/2.2/mod/core.html#options # for more information. Options Indexes FollowSymLinks # # AllowOverride controls what directives may be placed in .htaccess files. # It can be "All", "None", or any combination of the keywords: # Options FileInfo AuthConfig Limit # AllowOverride None # # Controls who can get stuff from this server. # Order allow,deny Allow from all </Directory> I looked at several forums and there were many suggestions to change this part of the .conf file. However, I understood that by adding the code that i did add to the end of the file, i have basically just controlled the amount of space that i have opened up to being controlled from the .htaccess file. I have placed my .htaccess file in both the main htdocs root folder, but also in the project_1 root_folder. This is also where my index.php file is. My contents of the .htaccess file are as follows: # project_1 .htaccess <IfModule mod_rewrite.c> RewriteEngine on RewriteBase /PHPadvanced/project_1/ RewriteRule ^(about|contact|this|that|search)/?$ index.php?p=$1 </IfModule> I am now trying to go to my browser and type in http://localhost/PHPadvanced/project_1/about But this is just bringing up the following message. Not Found The requested URL /PHPadvanced/project_1/about was not found on this server. I am struggling as i am not quite sure where i am having problems. PLEASE HELP!!!
  3. First, I've been pulling my hair trying to resolve this problem, I really would like to be able to have clean urls. First I running on Windows 8 using XAMPP ( I now wish I was using Linux ). I made sure that my .htaccess file does indeed start with a period Here the .access file # Script 2.7 - .htaccess<IfModule mod_rewrite.c> # Turn on the engine:RewriteEngine on # Set the base to this directory:RewriteBase /chapter02/ # Redirect certain paths to index.php:RewriteRule ^(about|contact|this|that|search)/?$ index.p </IfModule> here's the bottom of my httpd.conf file # AJP13 Proxy<IfModule mod_proxy.c><IfModule mod_proxy_ajp.c>Include "conf/extra/httpd-ajp.conf"</IfModule></IfModule><Directory "c:/xampp/htdocs/php_test/chapter02"> AllowOverride All</Directory> and here's part of my config.inc.php file // Determine location of files and the URL of the site:// Allow for development on different servers.if ($local) { // Always debug when running locally: $debug = TRUE; // Define the constants: define('BASE_URI', 'c:/xampp/htdocs/php_test/chapter02'); define('BASE_URL', 'http://localhost/php_test/chapter02/'); define('DB', '/path/to/mysql.inc.php'); } else { define('BASE_URI', '/path/to/live/html/folder/'); define('BASE_URL', 'http://www.example.com/'); define('DB', '/path/to/live/mysql.inc.php'); } Like I said I've been pulling my hair out, stopping apache server, restarting it, modifying code, restarting (even rebooting my machine once). I even did a Google search trying various "fixes" and even this forum. Any help would be greatly appreciated. I know it is probably something stupid that I'm doing. Best Regards, John
  4. Hi Larry, First of all this Effortless E-Commerce has been very helpful in my understanding of build e-commerce sites. I truly feel it is the best resource out there on the subject. I am new to PHP and MySQL, and your books have helped me learn in a short period of time. My question has to do with .htaccess and mod_rewrite. I am using Yahoo Small Business as a host (for now), but they do not allow .htaccess. I know it would be easier for me to change hosting services, but I cannot at the moment, so I need to find a way around this problem. You stated on page 175 under the Tips sidebar that 'If you can’t use mod_rewrite on your server, just skip this section and change every URL in the HTML files accordingly.' Where exactly would I change these URLs? Is there an alternative to this similar to the alternatives for the stored procedures? Thank you in advance.
  5. I'm trying to do mod_rewrite like this: RewriteEngine On RewriteRule ^cancer/?$ cancer.php RewriteRule ^ptsd/?$ptsd.php I have my testing directory, named minus, so the same code should be at adviceofthequeen.com and adviceofthequeen.com/minus/ I put this code into the .htaccess file in minus directory and when I type into browser: http://adviceofthequeen.com/minus/cancer the cancer.php page comes up correctly. But when I type into browser: http://adviceofthequeen.com/minus/cancer/ the cancer.php pages comes up but without the style sheet and images. So I also put this same code into .htaccess file above the minus directory (the real live code) and when I type into browser: http://adviceofthequeen.com/ it throws a 500 Internal Server Error. I'm pretty sure that if I ask hosting tech support about this they will suggest I use the cpanel redirect. I want to do this for all my files and now there is only 6 but there could be maybe about 50 when I'm done. It doesn't seem that redirect is the best way to do this. Is there any syntax error in my mod_rewrite? There was nothing in the .htaccess files except directory protection in the minus directory which is temporarily not on right now. Apache version 2.2.21 PHP version 5.2.17 MySQL version 5.0.92-community-log
  6. Hello everyone, My boss has two websites -- one of which they wanted me to clone to replace the other. They are on two different servers. They had me transfer the website files, reconfigure to a new database on a new server, and then make cosmetic changes. However, I am finding that none of the links on the clone (apart from the home page) actually work. For instance, if you click "What's New" this should link to the Who We Are page. The URL it links to is: /who-we-are (without any php extension). There is a .php file on public_html that is titled "who-we-are.php." The absence of an extension in the URL made me think there was an .htaccess file, and there was: [/color][/color][/font][/size] Options -MultiViews Options +FollowSymLinks RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d #RewriteRule ^(.*)$ $1.php [L,QSA] RewriteRule ^search([\/]?)$ index.php?option=collection-products&section=collection&%{QUERY_STRING} [L,QSA] RewriteRule ^page\/([a-zA-Z0-9_-]+)([\/]?)$ index.php?option=pages&url=$1&%{QUERY_STRING} [L,QSA] RewriteRule ^product\/([a-zA-Z0-9_-]+)\/([a-zA-Z0-9_-]+)([\/]?)$ index.php?option=product&category=$1&producturl=$2&%{QUERY_STRING} [L,QSA] RewriteRule ^products\/([a-zA-Z0-9_-]+)([\/]?)$ index.php?option=collection-products&section=collection&productcat=$1&%{QUERY_STRING} [L,QSA] RewriteRule ^products\/([a-zA-Z0-9_-]+)\/([a-zA-Z0-9_-]+)([\/]?)$ index.php?option=collection-products&section=collection&category=$1&productcat=$2&%{QUERY_STRING} [L,QSA] RewriteRule ^products\/([a-zA-Z0-9_-]+)\/([a-zA-Z0-9_-]+)\/([a-zA-Z0-9_-]+)([\/]?)$ index.php?option=collection-products&category=$1&section=collection&subcategory=$2&productcat=$3&%{QUERY_STRING} [L,QSA] RewriteRule ^collection\/([a-zA-Z0-9_-]+)([\/]?)$ index.php?option=collection&section=collection&category=$1&%{QUERY_STRING} [L,QSA] RewriteRule ^collection\/([a-zA-Z0-9_-]+)\/([a-zA-Z0-9_-]+)([\/]?)$ index.php?option=collection&section=collection&category=$1&subcategory=$2&%{QUERY_STRING} [L,QSA] #RewriteRule ^detail\/([a-zA-Z0-9_-]+)\/([a-zA-Z0-9_-]+)([\/]?)$ index.php?option=cat_page_more&section=$1&category=$2&%{QUERY_STRING} [L,QSA] #RewriteRule ^philanthropy([\/]?)$ index.php?option=our-work&section=philanthropy&&%{QUERY_STRING} [L,QSA] RewriteRule ^philanthropy\/([a-zA-Z0-9_-]+)([\/]?)$ index.php?option=cat_pages&section=philanthropy&category=$1&%{QUERY_STRING} [L,QSA] RewriteRule ^philanthropy\/([a-zA-Z0-9_-]+)\/([a-zA-Z0-9_-]+)([\/]?)$ index.php?option=cat_page_detail&section=philanthropy&category=$1&pageurl=$2&%{QUERY_STRING} [L,QSA] RewriteRule ^our-work\/([a-zA-Z0-9_-]+)([\/]?)$ index.php?option=cat_pages&section=our-work&category=$1&%{QUERY_STRING} [L,QSA] RewriteRule ^our-work\/([a-zA-Z0-9_-]+)\/([a-zA-Z0-9_-]+)([\/]?)$ index.php?option=cat_page_detail&section=our-work&category=$1&pageurl=$2&%{QUERY_STRING} [L,QSA] RewriteRule ^([a-zA-Z0-9_-]+)\/([a-zA-Z0-9_-]+)([\/]?)$ index.php?option=cat_page_detail&section=$1&pageurl=$2&%{QUERY_STRING} [L,QSA] RewriteRule ^our-services([\/]?)$ index.php?option=cat_pages&section=our-services&%{QUERY_STRING} [L,QSA] #RewriteRule ^philanthropy([\/]?)$ index.php?option=cat_pages&section=philanthropy&%{QUERY_STRING} [L,QSA] RewriteRule ^conceptual-gift-design([\/]?)$ index.php?option=cat_pages&section=conceptual-gift-design&%{QUERY_STRING} [L,QSA] #RewriteRule ^our-services\/([a-zA-Z0-9_-]+)([\/]?)$ index.php?option=cat_page_detail&section=our-services&pageurl=$1&%{QUERY_STRING} [L,QSA] #RewriteRule ^our-work([\/]?)$ index.php?option=collection&section=our-work&%{QUERY_STRING} [L,QSA] RewriteRule ^([a-zA-Z0-9_-]+)([\/]?)$ index.php?option=$1&%{QUERY_STRING} [L,QSA] It references a symlink. On the original website, there are two symlinks in the root/ folder (not public_html) that are titled: www -> public_html; and then another called, access_logs -> ../domlogs/artmorp1. I assume I need to add the symlinks to the new server for the new site, but can anyone help me understand what is actually going on in this situation? It would help if you could point out what the problem with the clone, and give me suggestions as to how to fix it. Many thanks.
×
×
  • Create New...