When I go to my first url, example: website.be/festivalName/eventName then te script on the url, website.be/festivalName, runs.
What am I doing wrong?
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)/([^/]+)$ views/festivals/index.view.php?organisation=$1&festival=$2&event=$3 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)$ views/festivals/index.view.php?organisation=$1&festival=$2 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)$ views/organisations/index.view.php?organisation=$1 [L]
I have a long URL like this http://example.com/interview/folder1/folder2/xxx. I need that page to be opened also in the short form like this http://example.com/interview/xxx.
I have tried this, it didn't help
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_URI} !^interview/folder1/folder2/
RewriteRule (.*) interview/$1
Please note that this is an excerpt from the htaccess which is much larger.
What am I doing wrong?
You can try this .htaccess file:
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_URI} !^interview/folder1/folder2/
RewriteRule ^interview/(.*)$ /interview/folder1/folder2/$1 [L]
i have made a .htaccess file but a problem occurs is that conflicting with other file
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^f9/([^/\.]+)?$ footer_arts.php?page=$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^f10/([^/\.]+)?$ footer_bus.php?page=$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^f11/([^/\.]+)?$ footer_cely.php?page=$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^f12/([^/\.]+)?$ footer_com.php?page=$1 [QSA,L]
RewriteRule ^f13/([0-9]+)$ footer_edu.php?page=$1
when i open www.example.com/f9/1 its open perfectly , but when i open www.example.com/f10/1 or www.example.com/f11/1 it shows another page which is in my htaccess file just like f13/1, how can i prevent this conflicting and open correct page
Try your code this way.
RewriteEngine On
#if the request is a real file or directory, do nothing otherwise process one of the rules below.
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^f9/([^/]+)/?$ footer_arts.php?page=$1 [QSA,L]
RewriteRule ^f10/([^/]+)/?$ footer_bus.php?page=$1 [QSA,L]
RewriteRule ^f11/([^/]+)/?$ footer_cely.php?page=$1 [QSA,L]
RewriteRule ^f12/([^/]+)/?$ footer_com.php?page=$1 [QSA,L]
RewriteRule ^f13/([0-9]+)/?$ footer_edu.php?page=$1 [QSA,L]
I have PHP file .htaccess :
Options -Multiviews
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteCond %{REQUEST_URI} !/$
RewriteRule (.*) $1\.php [L]
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-zA-Z0-9_-]+)$ user.php?user=$1
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/home/.*$ index.php [QSA]
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/friends$ friends.php?user=$1 [L]
RewriteEngine On
RewriteRule ^post/(\d+)/([a-z-]+) post.php?id=$1&title=$2 [L]
Now I want the url post to be like this :
http://example.com/yoana/post/id_post
I tried with that rule above, but it is still not working.
The error is :
Object not found!
Any ideas?
I have just installed phplinkdirectoy.
I can view the home page fine.
But when I go to any other page I get a 500 server error.
I believe this is due to problems with my .htaccess file, as if I delete the .htaccess file I get a 404 error when going to anything other than the home page.
As an example, part of my .htaccess file looks like this:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^submit$ index.php?controller=submit [QSA,NC,L]
I have tried making it look at the install directory on my server by changing it to this:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^submit$ /other_sites/abc.example.com/index.php?controller=submit [QSA,NC,L]
n.b. /other_sites/abc.example.com/ is where the files are stored on my godaddy hosting account. The url of the directory is actually dir.gingercatgames.com
What am I doing wrong with my .htaccess file?
Update: The full .htaccess file is here:
#######################################################
## PHP Link Directory 5.x - Apache Server Settings ##
#######################################################
# Disable directory browsing
#Options -Indexes
# Follow symbolic links in this directory
#Options +FollowSymLinks
# Override PHP settings that cannot be changed at runtime
# (If your server supports PHP settings via htaccess you can comment following two lines off)
# php_value register_globals 0
# php_value session.auto_start 0
# Customized error messages
# ( If you are running in a subfolder please add it, example: "directory/index.php?httpstatus=404" )
#ErrorDocument 404 index.php?httpstatus=404
# Set the default handler
DirectoryIndex index.php
# URL rewrite rules
<IfModule mod_rewrite.c>
RewriteEngine On
#Make sure RewriteBase points to the directory where you installed phpLD.
#Example: "/phpld" if your installation is in a "phpld" subdirectory.
#RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^contactlisting index.php?controller=details&action=contactlisting [QSA,NC,L]
##Old Details Link Page Rewrite
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule (.*)detail/(.*)$ index.php?controller=system&action=detailsredirect&id=$2 [QSA,NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^detail.php index.php?controller=system&action=detailsredirect&id=$1 [QSA,NC,L]
##alphameric Page Rewrite
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^alphameric/([A-Za-z]|0\-9)$ index.php?controller=alphameric&id=$1 [QSA,NC,L]
##Author Page Rewrite
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^contact index.php?controller=contact [QSA,NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^search/([^/]+) index.php?controller=search&action=$1 [QSA,NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^search index.php?controller=search [QSA,NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^latest index.php?controller=index&action=latest [QSA,NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^top index.php?controller=index&action=top [QSA,NC,L]
#RSS
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^rss index.php?controller=index&action=rss [QSA,NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^user/thankyou$ index.php?controller=user&action=thankyou [QSA,NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^user/confirmed$ index.php?controller=user&action=confirmed [QSA,NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^user/sendpassword$ index.php?controller=user&action=sendpassword [QSA,NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^user/recovered$ index.php?controller=user&action=recovered [QSA,NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^submit$ index.php?controller=submit [QSA,NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^submit/confirmed$ index.php?controller=submit&action=confirmed [QSA,NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^payment/([^/?]+) index.php?controller=payment&action=$1&%{QUERY_STRING} [QSA,NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^payment index.php?controller=payment [QSA,NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^user/submissions$ index.php?controller=user&action=submissions [QSA,NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^user/register$ index.php?controller=user&action=register
##Author Page Rewrite
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^login$ index.php?controller=user&action=login
##Author Page Rewrite
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^logout index.php?controller=user&action=logout
##Author Page Rewrite
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^user/profile index.php?controller=user&action=profile
##Author Page Rewrite
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^user/([^/?]+) index.php?controller=user&action=$1&%{QUERY_STRING}
##Author Page Rewrite
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^user index.php?controller=user&action=index
##Author Page Rewrite
# RewriteCond %{REQUEST_FILENAME} !-f
# RewriteCond %{REQUEST_FILENAME} !-d
# RewriteCond %{REQUEST_FILENAME} !-l
# RewriteRule ^article/(.*)$ index.php?controller=article&idArticle=$1 [QSA,NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^tag/(.*)$ index.php?controller=tag&tag=$1 [QSA,NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^location/([\ 0-9a-zA-Z,_-]*)/(.*) index.php?controller=location&location=$1&category=$2 [QSA,NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^location/(.*)$ index.php?controller=location&location=$1 [QSA,NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^listing/comment/([0-9]*)$ index.php?controller=details&action=comment&idLink=$1 [QSA,NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^listing/rate/([0-9]*)$ index.php?controller=details&action=rate&idLink=$1 [QSA,NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^listing/(.*)/(.*)([/]*)$ index.php?controller=details&idLink=$2 [QSA,NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^listing/(.*)/(.*)([/]*)$ index.php?controller=details&idLink=$2 [QSA,NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^rules([0-9]*)$ index.php?controller=index&action=rules [QSA,NC]
##Author Page Rewrite
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule (.*)authors/author-(.*)\.htm[l]?$ index.php?controller=author&action=index&idUser=$2 [QSA,NC]
##Owner Page Rewrite
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule (.*)owner/owner-(.*)\.htm[l]?$ index.php?controller=author&action=index&idUser=$2 [QSA,NC]
##Pagination Rewrite
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^page/(.*)([/]*)$ index.php?controller=page&action=index&name=$1 [QSA,NC,L]
RewriteRule ^(.*)loadingAnimation.gif$ javascripts/thickbox/loadingAnimation.gif
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^tellfriend index.php?controller=details&action=tellfriend [QSA,NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^unauthorized index.php?controller=index&action=unauthorized [QSA,NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^banned-massage index.php?controller=index&action=banned [QSA,NC,L]
##Old Details Link Page Rewrite
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^detail/(.*)-([0-9]*)[\..*] index.php?controller=system&action=detailsredirect&id=$2 [QSA,NC,L]
## Domain.com/{link-type}/{title-of-link}-{link-id}.{html|.htm|.php}
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)/(.*)([/]*)\.(.*)$ index.php?controller=details&idLink=$2 [QSA,NC,L]
## Domain.com/{link-type}/{title-of-link}-{link-id}
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)/(.*)([/]*)$ index.php?controller=details&idLink=$2 [QSA,NC,L]
## Domain.com/{title-of-link}-{link-id}.{html|.htm|.php}
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)([/]*)\.(.*)$ index.php?controller=details&idLink=$1 [QSA,NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^detail.php index.php?controller=system&action=detailsredirect&id=$1 [QSA,NC,L]
##Pages redirect
RewriteCond %{REQUEST_URI} !page-[0-9]+\.html?$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)\.html$ index.php?controller=page&name=$1 [NC,QSA,L]
##Category redirect
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
#<IfModule mod_fcgid.c>
# MaxRequestLen 1000000000
# IPCConnectTimeout 100
# IPCCommTimeout 1000
#</IfModule>
The 500 error sounds like either the result of a Multiviews setting, or not having mod-rewrite enabled in htaccess.
Try adding this at the top of your original htaccess:
Options -Multiviews
Also check that mod_rewrite is both installed and activated for htaccess files.
If you are not sure, to check if mod_rewrite is installed, look at the list of installed modules in the output of phpinfo();
By default, mod_rewrite is not enabled for htaccess files. If you are managing your own server, open httpd.conf
and make sure that the webroot directory block contains one of these lines: AllowOverride FileInfo or AllowOverride All