Search the Community
Showing results for tags 'clean url'.
I have my own website that I am trying to install clean search engine friendly urls on. I am doing this for the article page section of my site. I have it working except for a glitch. I am comparing my setup with that of this website and others which use htaccess clean urls. So basically I have my url which is like the following. http://stackoverflow.com/questions/9183130/php-htaccess-apply-page-title-in-url it works when I click on it and everything is fine. but if I take a part of the url like so: http://stackoverflow.com/questions/9183130/php-htaccess-apply-pag and refresh it still works which is ok. but the url doesn't return to the former one, it stays like that, missing part of the title in the url. I can't figure out how to make it revert back to the original url. All pages which seem to use clean urls have it working like that. here is my htaccess rule. and then I will show you the link I am using to link to the page. RewriteEngine On RewriteRule ^article/([0-9]+)/([a-zA-Z]+) article.php?id=$1&title=$2 $punctuation = array('$', '-', ',', '/', '\\', '!', '.', ' ', '*', '&', '?', '%', '\'', '<', '>', '[', ']', '(', ')'); $real_title = str_replace($punctuation, '-', $row5['title']); $real_title = str_replace(' ', '-', $real_title); $real_title = strtolower($real_title); $real_title = mysqli_real_escape_string($dbc, $real_title); <a href="http://www.example.com/article/'.$row5['article_id'].'/'.$real_title.'">'.$row5['title'].'</a>
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!!!