Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Clean URLs with PHP

.htaccess php clean url seo friendly

  • Please log in to reply
38 replies to this topic

#37 schnurzli

schnurzli

    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 14 February 2016 - 03:58 AM

Hi,

 

i've used your solution for a long time and it worked. Thanks for that!

 

Now i have a problem to get your example work for https:

 

The original .htaccess file:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [L]
</IfModule>

If i change the behaviour of the whole Website to force https i can't use it anymore.

 

For example if i am using the subfolder /test on my main Domain and then i call the clean url like: https://domain.com/test/aboutus which stands for

https://domain.com/test/views/xyz.php

 

I am getting this error:

Not Found

The requested URL /test/aboutus was not found on this server.

 

Without https it works like a charm. Afterthat I've tried to change my htaccess file like this:

<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteCond %{HTTPS} off
  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]  
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !=/favicon.ico
  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>

Same error...

Searched google for some hints but didn't find some working solutions.

 

I have no idea what i could do to solve this issue. Maybe someone has already solved this problem and wants to help me :-)

 

Thanks in advance,

Richard


Edited by schnurzli, 14 February 2016 - 04:09 AM.

  • 0

#38 redcab

redcab

    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 22 September 2016 - 03:31 PM

please help.

 

your navigation example works with an url like this:

 

domain.com/men

domain.com/women

 

but when it looks like...

domain.com/men/tshirt

domain.com/men/trousers

 

what I need to change to make it work?

 

switch($path_info['call_parts'][0]) {
  case 'men': include 'men.php';
    break; }

 

switch($path_info['call_parts'][1]) {
  case 'tshirt': include 'tshirt.php';
    break; }

 

or

 

switch($path_info['call_parts'][1]) {
  case 'men/tshirt': include 'tshirt.php';
    break; }


  • 0

#39 Richardovellee

Richardovellee

    CC Lurker

  • New Member
  • Pip
  • 3 posts

Posted 19 December 2016 - 01:52 PM

Hi, There is no resource on the web. I have spent long hours but got no information. I need to work with transparent images. But I had lots of unsolved problems. I am planning to change my direction. The worst documented project I have ever seen
  • 0





Also tagged with one or more of these keywords: .htaccess, php, clean url, seo friendly