spot7.org logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories

.htaccess create user friendly url and ridirect to it


The rewrite rules don't just make the URL string look different, it actually directs the user to the file at the end of the path even if you don't see it in the address bar. If Homepage is a directory containing index.php, even if that php file name doesn't appear in the URL, then it's causing a loop because it's directing you to a directory with an index.php.

The rule is executed every time that page loads. So, you're redirecting to a page which runs the redirect script, so it runs the rule to redirect again, and that causes the loop. What you want to do is create a condition that says "Don't run this code if the requested page is http://localhost/siti/socialmark/Homepage"

Something like this (you may have to adjust it)

RewriteBase /
RewriteCond %{REQUEST_URI}
!=/siti/socialmark/Homepage
RewriteRule ^Homepage index.php [NC,L]

For more details, see the caveats and example here: http://httpd.apache.org/docs/2.2/rewrite/flags.html#flag_l


Categories : PHP

Related to : .htaccess create user friendly url and ridirect to it
Friendly urls with htaccess in ads app
You can have your rules like this: RewriteEngine on RewriteBase / RewriteRule -da([0-9]+)/?$ ad_detail.php?ad=$1 [L,QSA] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{DOCUMENT_ROOT}/$1.php -f [NC] RewriteRule ^(.+?)/?$ $1.php [L]

Categories : PHP
How can add parameter in htaccess for rewrite condition in htaccess
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}s/+viewgallery.php?cname=([^&s]+)&pcaption=([^&s]+)&q=([^&s]+) RewriteRule ^ /photos/%1/%2/%3/? [R=301,L] RewriteRule ^photos/([^/]+)/([^.]+)/([^.]+)/$ /viewgallery.php?cname=$1&pcaption=$2&q=$3 [L,NE]

Categories : PHP
Active admin with friendly id
Found solution for the problem: In your app/admin/[ResourceName.rb] add: # app/admin/group.rb # find record with slug(friendly_id) controller do def find_resource begin scoped_collection.where(slug: params[:id]).first! rescue ActiveRecord::RecordNotFound scoped_collection.find(params[:id]) end end end This solved my problem.

Categories : Ruby On Rails
How to display a really long form in a user-friendly way?
Accordion Sample: <ajaxToolkit:Accordion ID="MyAccordion" runat="server" SelectedIndex="0" HeaderCssClass="accordionHeader" ContentCssClass="accordionContent" FadeTransitions="true" FramesPerSecond="40" TransitionDuration="250" A

Categories : Asp Net
SQL Azure Friendly Database Versioning Idea
You seem to be asking how to store some some data in a stored procedure, which is odd, because SQL server is a fantastic tool for storing data, but not in stored procedures. I'd say a much better strategy would be to create a very simple table to store the information you mentioned in your comment i.e. CREATE TABLE dbo.DatabaseVersion ( Date datetime, VersionNumber decimal(5,2), Des

Categories : Sql Server
Recently Add
Cartesian product of associative array showing key and value - PHP
Datamapper orm save and update not working
find methods in COM object
PHP Keyword search not working with multiple words
Set a total based on items ordered, two types, and sometimes one type will not be ordered.
FB request to join a group, going around their official SDK
Using Google charts with php data?
OAuth2 integration with ExactOnline
libvirt-php receives the error: unable to connect to server Permission denied
How to echo results by sets of 2?
Why does PHP's sprintf not round 5s reliably?
php replace affects on replaced string
PHP Find and replace multiple similar entries
Replace PHP date output with pre-made images
How to install Laravel 4 packages on Windows
Using updateOrCreate for multiple data insert in Laravel
Storing products in a MYSQL database and then search and filter them?
Create order with PrestaShop's API
how to get latest messages from all users
Yii CMultiFileUpload Restrict Image width
Combine array by key factor
Semicolon after if condition in PHP - code still works
Get date using day of the week
soap web service with symfony
Seasonal Reservation system Day/month
is it possible to join a single table it self?
Attempting to compare two arrays PHP
Sticky Select Option
Eventbrite duplicate event entry
Pagination Not Working on custom post type in Wordpress
© Copyright 2017 spot7.org Publishing Limited. All rights reserved.