I have the following .htaccess file in the root (htdocs/johndoe) of my web document tree where index.php is found:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/?$ index.php?lang=$1&menu1=$2&menu2=$3 [QSA,NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/([^/]+)/?$ index.php?lang=$1&menu1=$2 [QSA,NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/?$ index.php?lang=$1 [QSA,NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule sitemap.xml sitemap.php
Not sure what I am doing wrong, but when I access:
http://localhost/johndoe/sitemap.xml
it just loads my index.php instead of calling sitemap.php. Where am I going wrong? Thanks.
Moving the rule:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule sitemap.xml sitemap.php
to the top of the .htaccess file just after the RewriteEngine on directive seemed to solve my problem.
Related
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 the following in my .htaccess:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [L]
This works nicely, but I don't want the RewriteRule to trigger for the following folder and its subfolders.
www.site.co.uk/Content
How do I do this?
Try this Rule,
RewriteEngine on
RewriteRule ^(content)($|/) - [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [L]
or create a .htaccess in content directory and put
RewriteEngine off
I am using the same code, but it work only on first project.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)$ index.php?pg=$1 [QSA,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'm using htaccess to rewrite my url first one is working fine now
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\?*$ /oneday/index.php?do=$1 [L,QSA]
to rewrite url but now I want to access my sub directories and my directories exists like this Oneday/files/pdf-generation/dock-receipt-PDF24032015.pdf and for this my code is
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)\?*$ /oneday/files/pdf-generation/path$1
and my complete code of htaccess is
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\?*$ /oneday/index.php?do=$1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)\?*$ /oneday/files/pdf-generation/path$1
but the second one is not working for me. How could I do this and Oneday is my project directory name.
Now first url create this link http://localhost/oneday/bookings and now I want to access my PDF files http://localhost/oneday/files/pdf-generation/dock-receipt-PDF03242015.pdf
You can target 2nd rule only for existing files:
RewriteEngine On
RewriteBase /Oneday/
RewriteCond %{DOCUMENT_ROOT}/Oneday/files/pdf-generation/path/$1 -f [NC]
RewriteRule ^(.+)$ files/pdf-generation/path/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?do=$1 [L,QSA]